This post is being written as part of Tutorial Group Writing project happening at The Writer’s Manifesto blog.

I talked previously about how there are a lot of basic things WordPress theme authors can do to make a theme more functional and appealing to WordPress users, such as separating blog comments from trackbacks.  Another thing that theme authors often forget to do is add “edit” buttons to posts, pages, and comments.   Having access to these buttons can save blog authors a lot of time when trying to manage their blogs.  As a result, I decided to write up a quick tutorial that explains the really simple process of adding edit buttons to your WordPress theme. 

If you’d like to add an “Edit” button on your individual posts or pages, here is the code you will want to place somewhere in your post and/or page template (usually called single.php and page.php) where you want it to display:

<?php edit_post_link(__("**Edit**"), ''); ?>

If you’d like to add an “Edit” button to your individual comments, here is the code you need to place somewhere in your comments loop (usually called comments.php) where you want it to display:

<?php edit_comment_link(__("**Edit**"), ''); ?>

A couple of quick notes about adding edit buttons to your theme:

  • These edit links will only appear if you are logged in with the appropriate priviledges (administrator, editor, etc.).  Your traffic will not see them.
  • You can wrap them in a div or whatever you would like to and then set its position in your stylesheet to appear where you want it to. 

Digg This! | Stumble it! | Add to Del.icio.us | | Print This! |

There Are 13 Responses So Far. »

  1. 1 Monika @ The Writers Manifesto
    Friday, October 12th, 2007 at 6:29 pm

    Hi Kyle,

    Excellent idea your blog. I shall be back for more great stuff from you. Thanks for the entry and best of luck for a chance at the top 3.

    Monika

  2. 2 Allen
    Saturday, January 12th, 2008 at 7:01 am

    Hi, I copied the edit_post_link from the article but it does not appear in my template.

  3. 3 Kyle Eslick
    Saturday, January 12th, 2008 at 7:40 am

    Allen,

    Can you verify that you were logged in at the time? You have to be logged in as Administrator (or one of the levels with editing permissions) in order for the Edit button to show up. It won’t show up for your readers.

  4. 4 Dawn
    Wednesday, May 14th, 2008 at 12:31 pm

    I needed this. Found you on front page of google with search add edit posts wordpress. Good job!



Leave A Comment