Yet Another Featured Posts Plugin provides an easy AJAX interface to feature posts, with thumbnails & other display options for featured posts.
First, in the YAFPP settings page, check the checkbox 'Allow pages to be featured'. Now any pages you feature will show in the list of featured posts.
get_featured_posts() you can pass in the option
post_type to either
page to specify entries of that type. So to get a list of featured posts only:
<?php get_featured_posts( array('post_type' => 'post') ); ?>
Or pull a list of only featured pages:
<?php get_featured_posts( array('post_type' => 'page') ); ?>
YAFPP returns an array in this format:
<?php array( 'id' => '', // id of the post 'title' => '', // title of the post 'excerpt' => '', // excerpt of the post 'url' => '', // the post permalink 'image' => '', // an array of data for a YAPB image, if it exists 'author' => '', // the post's author ); ?>
the_loop output method, YAFPP alters the next instance of The_Loop to contain only the featured posts. To call these featured posts, call The_Loop:
<?php get_featured_posts(array('method' => 'the_loop')); while (have_posts()) : the_post(); //whatever you want in here endwhile; ?>
It should be noted that the original query is still preserved when using this method. Thus if you want to call the original query for a given page, just call The_Loop a second time:
<?php get_featured_posts(array('method' => 'the_loop')); while (have_posts()) : the_post(); //whatever you want to do with the featured posts endwhile; while (have_posts()) : the_post(); //whatever you want to do with the original loop endwhile; ?>
For more answers to your YAFPP questions, please read the complete documentation
Requires: 2.8.4 or higher
Compatible up to: 2.9.2
Last Updated: 7 years ago
Active Installs: 1,000+
Got something to say? Need help?