Adding Edit Buttons To Your WordPress Theme

May 6, 2008 · Print This Article

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. 

Your choice for site templates and wordpress themes


Got something to say?

You must be logged in to post a comment.