Okay, I have been fascinated with WordPress ever since I started to use it and I must admit, it has turned out nicely. Considering my fascination, I just had to write a plugin. Since I am showing a single post per page, I decided a ‘Recent Posts’ would be an acceptable plugin.
To get the ball rolling, I quickly learned that there is no ‘hook’ for the sidebar.php template. So I added the code:
<?php do_action('cp_sidebar_recentposts', ''); ?>
Now to get this to work properly, you will want to add it above the closing </ul> symbol. This way, when the recent posts section gets added, it is thrown in the navigation menu just like the others.
Next you need to ‘Save’ this file to your wp-content/plugins directory. Click on the ‘Save As…’ link to download the file. Finally, upload the file and your modified sidebar.php file and then activate the plugin via your Site Admin> Plugins section. Enjoy!
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment