First WordPress Plugin: Random Featured Posts Widget

Share

After tackling many other developmental aspects of WordPress, I finally got around to learning how to code a plugin. My first attempt was a widget that displays a random featured post with title, thumbnail, date, and link, that can be filtered by post category. I started out by modifying and then adding to code from two tutorials: How To Create Your Own Basic WordPress Widgets and Creating a Featured Post Meta Checkbox.

To add this plugin to your blog, download the code from my git repository and add the folder to your plugins under this file path: {site}/wp-content/plugins. Next, activate the plugin in your blog's dashboard.

You can then select the Random Featured Post widget under Appearance - Widgets.

The widget has a few custom options. You can change the display title. You can also limit the query to a specific category.

Once set up, all you need to do is go to the edit screens of your favorite posts and select the new featured post checkbox.

Now whenever you refresh a page containing the widget, you'll see a random featured post.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.