I love the idea of being able to edit my post whenever I want to, and not having to do that by going into wp-admin -> manage -> posts. As shown in the pic above, when the circled pencil is clicked, you will jump straight into your posts content to start editing. Here’s how I did it.
Depending on what wordpress theme you are using, you will usually see something similar to this piece of code in your single post.php and index.php
<div class="PostHead"> <h1 class="title"><a href="#"></a><a title="Permanent Link to <?php the_title(); ?>" href="< ?php the_permalink() ?>" rel="bookmark">< ?php the_title(); ?></a></h1> <p class="PostDate"> <strong class="day">< ?php the_time('d'); ?></strong> <strong class="month">< ?php the_time('M'); ?></strong> </p> <p class="PostInfo">Posted by < ?php the_author() ?> as <em>< ?php the_category(', ') ?></em></p> </div>
All you need to do is add a line of code so that:
<p class="PostInfo">Posted by < ?php the_author() ?> as <em>< ?php the_category(', ') ?></em>< ?php edit_post_link('<img src="'.get_bloginfo(template_directory).'/images/pencil.png" alt="Edit Link" />','',''); ?></p>
You can save the pencil.png file here:
Leave a Reply