Adding The Edit Function To Your Posts.

by Costa on December 6, 2007

A simple but yet useful function not found in many WordPress Themes is the “edit” function. I don’t know why , but even some of the best theme designers find it unnecessary to include this little piece of code in their themes.

The tiny “edit” button is found normally at the title bar or at the footer bar of every post and is only visible to the administrator. It allows the author to quickly make changes to the post if he detects some wrong spellings or something that doesn’t appear right in the post after hitting the publish button. Without that, they will have to go back to their dashboard all over again to access that post before they can edit it.

If your theme doesn’t comes with one, adding it yourself is not too difficult. It just a matter of inserting a single line of code to your Main Index and the Single Post File. Copy this line of codes entirely:

<?php edit_post_link(‘Edit’, ‘ | ‘, ”); ?>

To place it in your post title bar, look for the <div class= “post-meta-top”> tag in your Main Index php and paste it like the example below. Different themes might be written a little bit differently, but it will be more or less the same. Do the same thing for your Single Post php.

<div class=”auth”><span>Posted by <strong><?php the_author_posts_link(); ?><?php edit_post_link(‘Edit’, ‘ | ‘, ”); ?></strong></span></div>

The “edit” link will appear next to “Posted by XXX” in your post’s title bar.

Warning: As in tinkering with any codes in your templates, make sure to backup the whole file first. Just go to your Main Index php – right click-select all. Open your Notepad and paste the entire original file there. If you screw up, just copy the original files from your notepad, go back to your Main Index-right click-select all and paste back the original file. So keep experimenting until you are satisfied as to where you want the “edit” link to appear.

Related posts:

  1. How To Edit The 7 Dollar Script – Squeeze Page To make the 7 Dollar Script work with our WordPress blog, we are only going to edit 3 templates. Since we are keeping things simple and lean, we will not be going through the entire process that this script is designed to do. What we intend to do is, make...
  2. Latest WordPress Template – BlueSensation WordPress Theme Daniel form Daily Blog Tips released his latest Wordpress Template code named the BlueSensation WordPress Theme today. Like always my terrible weakness for new and pleasant looking themes got the better of me yet again and I had to put this theme up just to see if it fits my...
  3. How To Edit The 7 Dollar Scipt – Download Page The second template we must edit in the 7 Dollar Script is the download page. If you remember, to sell products in our WordPress blog, we will only be using the direct method. As we are only selling something that will benefit our readers and not doing it as an...
  4. Customizing Your First WordPress Theme Image via Wikipedia For those who wants to customize a WordPress Theme for themselves, the best place to start your experiments is the default theme that comes with your WoprdPress Installation. The default WordPress Theme has all the requirements for the latest version of WordPress and it is always...
  5. Use the Search Function to Look for the Post you want to Interlink. When Darren started his 31 Days project, I threw myself a challenge to see if I too, can come up with 31 tips of my own based on the experienced that I went trough when implementing tips that I have read from Problooger.net and various other blogs when I first...

{ 2 trackbacks }

Latest Adsense Optimized WordPress Theme | Blog Gigs
February 7, 2008 at 10:35 am
Things To Consider When Downloading A WordPress Theme | Blog Gigs
March 19, 2008 at 12:29 pm

{ 3 comments }

Sueblimely December 6, 2007 at 2:28 pm

This is a handy hint. I have bookmarked it for future reference. Thanks

Cfro May 19, 2009 at 10:41 pm

Thanks for this info, but do you know what I need to do so that the edit doesn’t look like “edit”

Costa May 19, 2009 at 11:12 pm

You can of course replace the word Edit within the quotation marks to any word you like. Some simply use the letter “e”

Anyway, the word or whatever letter you use is only visible to you and no one else and even then, you have to be logged in to see and use the Edit function. So how it looks doesn’t really matter much.

Comments on this entry are closed.