If you’ve picked up an older WordPress theme, you might just be missing a key feature included in most recent themes. And this feature is essential to CMS nirvana.
Front end editing.
What’s front end editing?
Front end editing is being able to navigate the site from the front end – like an end user – and just click a button, edit your post and go back to the front end.
Here’s what it looks like on this weblog (you won’t see it as you are not logged in and are unlikely to be in the future unless you work for Foliovision):
front end editing wordpress
Here it is actually at the bottom of a post.
I prefer the edit button at the top of a post actually.
To add it to your posts and pages, you have to open up the following file in your WordPress template: page.php.
The full path is: /wp-content/themes/yourtheme/page.php
Here is the code you need to paste in:
<p><?php // the edit link edit_post_link(__('Edit','drunkey-love'),'',''); // end of edit link ?></p>
You should paste it at the top of your page.php file.
Here’s what my finished page.php looks like for a new site:
<?php get_header(); ?> <div id="content"> <?php include(TEMPLATEPATH."/sidebar.php");?> <div id="contentmiddle"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <p><?php // the edit link edit_post_link(__('Edit','drunkey-love'),'',''); // end of edit link ?></p> <?php the_content(__('Read more'));?> <!-- <?php trackback_rdf(); ?> --> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?> </div> </div> <!-- The main column ends --> <?php get_footer(); ?>
With this code, if you are logged in you can now navigate to any page and edit on the spot. Your clients can too.
Everyone is happy.
For those who are not happy editing PHP (me until recently), here’s a zipped version of page.php which you can try replacing in your your theme directory /wp-content/themes/yourtheme/ . It will probably work.
Did not work for me. Nothing happened.
I am using the Studiopress theme on WordPress 2.6.2.
Thanks for your help.
Hello Srini,
We haven’t tested this on 2.6.2 as we have decided to stay with an older version of WordPress semi-permanently.
We don’t have the time to be checking for plugin updates and writing plugin updates ever two months – i.e. the constantly breaking internal API’s that Matt and co. have been playing with over the last year.
Let me know if you do get the technique to work, so I can post an update here.
Thanks.