Yet Another Featured Posts Plugin provides an easy-to-use interface for featuring specific posts in a WordPress blog. After installing the plugin, you can feature and unfeature posts by clicking on each post’s ‘featured star’ in the WordPress edit posts page.
Yet Another Featured Posts Plugin has a variety configuration options, allowing you to control a number of display options as well as which users can feature posts. For developers YAFPP allows several output options besides the default: it can return a data array, modify the next query for WordPress’ the_loop(), and or return formatted data (which can be easily formatted through the admin panel).
How to use YAFPP
To start, download YAFPP and upload it to your site’s
wp-content/plugins/ directory. Activate the plugin and go to the posts listing in your WordPress admin panel. Here you will see a grayed out star next to each post—simply click the star to feature (or unfeature) that post.
Next within your site template you can include a list of featured posts by calling:
<?php get_featured_posts(); ?>
To control how this list is displayed, go back to your WordPress admin panel to Settings > Featured Posts (YAFPP). Here you can select whether to display the title, post excerpt, or even the image from YAPB. You can control how long the post excerpt is, and the maximum number of featured posts to display.
Some advanced options for developers
While YAFPP is easy for first time users, there are a number of advanced options for developers. Mainly, YAFPP offers a couple output options to make your WordPress dev smoother. By default, the plugin echoes out formatted data (which can be controlled by the admin panel), but if you’d prefer to return this as a string you can pass this option in an array:
<?php $output = get_featured_posts( array( 'method' => 'return')); ?>
Other options for the
method include ‘arr’ which returns an array of various post data for the featured posts, and ‘the_loop’ which attaches the list of featured posts to the next instance of the_loop().
An example of ‘the_loop’ method is as follows:
<?php get_featured_posts(array('method' => 'the_loop')); while (have_posts()) : the_post(); //whatever you want in here endwhile; ?>
When using ‘the_loop’ method, the original WordPress loop is still preserved, it is just bumped so that the featured loop is called first. So if you need the original query, just call the_loop a second time.