WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Yet Another Featured Posts Plugin (YAFPP)] Exclude Sticky Posts?

[Plugin: Yet Another Featured Posts Plugin (YAFPP)] Exclude Sticky Posts?

  • breakingmedia
    Member

    @breakingmedia

    It might be nice, in future releases, to exclude sticky posts from the Featured Posts, since this group of posts by definition stands apart from the normal functionality of reverse-chronological post listing. As the plugin is now, stickies behave as normal, floating to top of any the featured posts query and pushing out any featured posts that are beyond the max.

    In my own modified version, I first added a single line at around line 39:


    $sticky = get_option('sticky_posts');

    Then I changed all instances of:


    $query_opts = apply_filters('yafpp_get_featured_posts_query', array(
    'post__in' => $featured_arr,
    'posts_per_page' => $yafpp_opts['max_posts'],
    ));

    to:


    $query_opts = apply_filters('yafpp_get_featured_posts_query', array(
    'post__in' => $featured_arr,
    'caller_get_posts' => 1,
    'post__not_in' => $sticky,
    'posts_per_page' => $yafpp_opts['max_posts'],
    ));

    Once that was done, the featured posts query behaved as intended, ignoring sticky posts.

  • The topic ‘[Plugin: Yet Another Featured Posts Plugin (YAFPP)] Exclude Sticky Posts?’ is closed to new replies.