Yet Another Featured Posts Plugin for WordPress (YAFPP)


Yet Another Featured Posts Plugin for WordPress (YAFPP)

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).

Download Yet Another Featured Posts Plugin (YAFPP)

YAFPP Screenshots

Read the documentation

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.

Visit the docs for more detailed info

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.

Download YAFPP

Visit the docs for more detailed info



Jon Raasch

Jon Raasch is a UX nerd and free-lance web designer / developer who loves jQuery, Javascript & CSS.




You Might Also Like:


31 Comments to “Yet Another Featured Posts Plugin for WordPress (YAFPP)” RSS 2.0

  1. Tejaswini says:

    Excellent Plugin! I liked it.
    A small correction, on the Wordpress page (from readme.txt) you have mistakenly put the template tag as “” which should be as you mentioned on this page.
    I was trying it and messed up a little bit.
    But overall, I should congratulate you for this great resource.

  2. Tejaswini says:

    Oh sorry, your comment does not accept PHP opening and closing tags and so not showing my comment properly. The template tag was get_post_listing();

  3. Jon Raasch says:

    Ugh woops! Thanks a lot for pointing that out Tejaswini, it’s fixed now

  4. VVOR says:

    Thanks for the plugin!
    Great

  5. Ayaz Malik says:

    Hiiz,
    the plugin is excellent. but there seems to be one problem in it. if i get on a post the links of the featured posts are replaced to the current post page. plz see this link
    http://www.alliance.com.pk/microsoft-trainings/ts-microsoft-internet-security-and-acceleration-server-2006/
    you will understand.

  6. Jon Raasch says:

    Hi Ayaz,

    Sorry I’m not sure I understand exactly what the problem is and I haven’t run into any issues with YAFPP on a single post page. Have you made sure to include the get_featured_posts() template tag on your single.php theme file? I’m thinking maybe it’s only on the index.php theme file so the featured posts aren’t showing up in the single post view.

    Best,
    Jon

  7. Ayaz Malik says:

    hiiz,
    they are showing fine everwhere. but the problem is if u are on a post , the link of the featured post is replaced the current post we are on. for example the link to feature post is 123.html and i am on a pge abc-12.html the link on this page of featured post will be changed to abc-12.html. lol i tried explainin.
    thanks

  8. Ayaz Malik says:

    btw i have placed the featured post below menu on top so it will shpw up on every page. please taek a view http://www.alliance.com.pk
    Regards

  9. Stacy says:

    I cannot get the option to use Images. Is there another plugin I have to install for this to work? I see in the second screenshot that there should be a column for “images” but I do not have that in my site.

  10. Jon Raasch says:

    Hey Stacy -
    The image option in YAFPP works with YAPB (Yet Another Photoblog) which you can get here: http://wordpress.org/extend/plugins/yet-another-photoblog/

    Ayaz -
    I’m not sure what’s causing that problem (and I still don’t see anything on the individual post pages on your site). I’ll look into this soon, but I’d guess that if this problem exists it can be solved right now by calling get_featured_posts() outside of The_Loop, so try that for an immediate fix and I’ll get back to you on the larger issue.

    Best,
    Jon

  11. Stacy says:

    Thanks for the response on the YAPB pluggin. I figured it out because I actually read the docs completely!

    New problem. On the home page, the cache/database isn’t clearing out the old deleted featured posts. Additionally, the permalink isn’t working and neither is the ability to show the thumbnail.

    http://smallchurchcmsreviews.com/

    What the heck is going on? I made “some” changes to the code and it worked fine last night but today it’s all jacked. Any ideas?

    BTW, GREAT plugin!

  12. Jon Raasch says:

    Hi Stacy,

    Hehe reading the docs is always a good idea ;)

    Right now YAFPP doesnt check to see if a post has been deleted, so make sure to unfeature anything you want removed (which you can do from the YAFPP options menu as well as the edit posts listing). And I’ll add a test to see if the post is available to the plugin soon.

    As for the permalink problem, I’ll be looking into that soon – I haven’t experienced it yet but Ayaz mentioned an issue with the permalinks, I think it has to do with The Loop. I’ll be looking into this soon.

    -jr

  13. Ayaz Malik says:

    hiiz, thanks bro, yes im going to try with the loop.
    Regards

  14. Marcelo says:

    Hello, congratulations for the plugin. Unfortunately, when I get to the Posts > Edit page, the star for featuring a post won’t appear. I am using WP 2.8.4. Best regards…

  15. Jon Raasch says:

    Hey Marcelo – two things, first make sure you are on the post listing page as opposed to the individual post editing page (in Posts > Edit), and if you are make sure that yafpp is in your plugins directory under the directory named yet-another-featured-posts-plugin.

    Best,
    jr

  16. Marcelo says:

    great, the mistake was the folder name, mine was “yet-another-featured-posts-plugin.1.1″. let’s try it

  17. Ayaz Malik says:

    hiiz,
    any luck with the permalink issue? regards

  18. Jon Raasch says:

    Hey Ayaz and Stacy,

    Sorry for taking so long to get back to you.

    The problem you’re having most likely boils down to another I’ve noticed when calling <?php get_featured posts(); ?> within ‘The Loop’.

    But you can pretty easily get around this, just use the ‘return’ method anywhere outside of the loop, for instance:
    <?php $featured_posts = get_featured_posts( array( 'method' => 'return')); ?>

    Then wherever you want to put the featured posts:
    <?=$featured_posts; ?>
    (this can go inside the loop)

    Sorry about the inconvenience of that; I’ll fix it so it doesn’t happen at all in a later release.

    Best,
    Jon

  19. Ayaz Malik says:

    hiiz again.
    yes i did that but now permalinks on homepage even chagned to home’s link.
    Regards

  20. justbishop says:

    I’m having the same issue that Ayaz Malik posted about at first.
    I’ve put the featured posts template tag into my sidebar.php…when on the home page, each of the featured posts listed link to the correct place (their respective single post pages), but if I’m on a single post’s page, all of the featured posts in the sidebar link to the post that I’m on. I hope that made sense :/

  21. Anthony says:

    Hi .. great plugin! Is this compatible with 2.8.5? .. When I run it all I can get the plugin to generate is a link of the post title. It won’t post any of the excerpt, no matter what options I specify in the settings. I’m using the return method you specify above. Is this something I’m doing wrong or an incompatibility with 2.8.5? I looked in the docs at the array section, but am unclear where to put it relative to the rest of the code. It would be useful if you posted a full example of using the array in the docs. Thank you for your thoughts!

  22. Jon Raasch says:

    Hey Ayaz and JustBishop,

    I finally spotted that bug and fixed it, very sorry for taking so long to do so. Get the newest version of the script here: YAFPP 1.2

    Anthony – I have YAFPP working just fine in Wordpress 2.8.5 using the return method and titles/descriptions/photos, maybe try upgrading to YAFPP 1.2 and let me know if you’re still having trouble.

    -jr

  23. Anthony says:

    Jon, thank you kindly for offering to help. I know it’s a pain and donations are always far too meager to account for your time! =)

    As a general comment, I’m pretty sure I’d be able to figure out my issue if this site showed the php markers in the docs. In the basic setup, for instance, I’m fairly certain you want the get_post_listing(); within the typical php markers, but it becomes difficult to know when you’re omitting them, especially for novice users.

    As it stands right now, the only thing I can get going are links of the featured posts by calling get_featured_posts() between php markers. No excerpts or anything I select on the options. If I try the get_post_listing(); (basic setup in the docs) between opening and closing php markers, it just bricks my theme (the page ends abruptly where the code is). That seems to be what connects to the options settings per your docs, but I can’t get that working.

    I have no idea what to do with the array. It would be useful to have a single example, with all the proper markers. For instance, if you wanted to build an array that showed the post ID, excerpt, and the author, what would it look like? You show the possible values but do not appear to give an example of them working together to make a featured post in the content of a wp template. This is probably elementary to you, but I’m still learning! =)

    So I’m running into a wall even getting the basic config working. I’m usually serviceable modifying code if necessary, but I’m failing miserably just following the docs! =)

  24. Jon Raasch says:

    Hi Andrew,

    Per your request I added that array of options that can be passed to <?php get_featured_posts(); ?> to the docs: Click here.

    I also added the PHP tags to the codebits in the docs and this post to avoid any further confusion.

    Best,
    Jon

  25. yaacov says:

    how do i use a picture / image from the “custom field” in the post ?

  26. Mike says:

    I can’t select featured posts. I.m running WP 2.8.6. Is there something that needs to be set?

  27. Jon Raasch says:

    @yaacov – The built in image support only interfaces with YAPB at the moment – I’ll think about adding in support for passing a custom field, however for now you’ll have to either use the the_loop method (described here) or attack the plugin core to make that happen

    @Mike – I haven’t tested in WP 2.8.6 yet, I’ll take a look soon. I can tell you that all is well in 2.8.5 (but that obviously doesn’t help you too much :) ).

  28. Ron says:

    Heads up – I had some serious issues getting it to work in 2.8.6. I was trying to get it to output with ‘the_loop’ and then run the non-featured loop again.

    After banging my head against the wall I discovered that I just needed to put “wp_reset_query();” between the featured loop and the non-featured loop and it worked ok…

  29. Renee says:

    Hi, I am just learning WP and am building my site. I am a total novice and half of what is said is Greek to me. I have installed the plug-in but this part of it, I don’t understand:

    Next within your site template you can include a list of featured posts by calling:

    within my site template where? where do I put this little piece of code?

    thanks in advance for your help.

  30. PerS says:

    in WP 2.9, the embedded function new_excerpt_length($length) gives me the following error:

    PHP Fatal error: Cannot redeclare new_excerpt_length() (previously declared in /PATH/wp-content/plugins/yet-another-featured-posts-plugin/yafpp.php:47) in /PATH/wp-content/plugins/yet-another-featured-posts-plugin/yafpp.php on line 47

    Moving the function outside function get_featured_posts fixes the error.

  31. Chad says:

    is it possible to use YAFPP with Tan Tan Noodles (flickr album plugin)?

    YAFPP works great on my site, but I am unable to pull up any of the imported tan tan noodles albums



Leave a Reply



  • HTML permitted
  • Wrap code in <pre><code></code></pre>
  • Escape HTML to display as text