Add Edit Button to the Post Title

Posted on August 21, 2007
Filed Under WordPress Coding |

In most WordPress themes, a “Edit” link or button is coded for post title thus when you logged in you’ll see a Edit link or button displayed next to the article title or right after the article. If you click the link, it brings you directly to the Edit panel.

Without this link, you have to take a few more steps to edit an article. You have to login to admin panel, select Manage tab, click Post or Page submenu item, then find the article title from the list and click Edit link next to it to start edit.

Not all themes provide this Handy link. It’s not there in my theme Mordenpaper, not in this version at least. I don’t know why some well designed themes like Mordenpaper don’t include an edit link. Maybe that’s what so called minimalist. Anyway, the good thing is, it’s easy to add it.

The Edit link is provided by a simple WP function like
<?php edit_post_link(__(’Edit’)); ?>
here the ‘Edit’ is the link. If you want to put a button, just replace the word with an image URL.

To add the Edit link, go and find the article title display in php files, and add the function code next to it, something like:

<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h1> <?php edit_post_link(__(’(Edit)’)); ?>

Usually the title display code is in the following php files:
index.php
home.php
single.php
archive.php
page.php

Comments

Leave a Reply




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word