Support » Plugins and Hacks » Hacks » Add post title to edit entry link

  • Resolved Packer Greg

    (@packer-greg)


    I would like to add the title of a post to the “edit entry” link at the bottom of the post (i.e. Edit post for Chocolate Chip Cookie Recipe ยป )

    Among other things, I have tried

    <?php edit_post_link('Edit post for <?php the_title(); ?>', '<p>', '</p>'); ?>

    but the title never displays. I’ve also tried get_the_title and single_post_title to no avail.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The following code will do fine for you:

    <?php
    $titlename =  get_the_title();
    $title = 'Edit post for '. $titlename;
    edit_post_link($title, '<p>', '</p>');
    ?>
    Packer Greg

    (@packer-greg)

    Thank you. PHP is starting to make sense to me. I hope to pay it forward some day.

    I’m glad that it worked for you ๐Ÿ™‚

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add post title to edit entry link’ is closed to new replies.