WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Featured Posts Plugin (YAFPP)
Exclude Sticky Posts? (1 post)

  1. breakingmedia
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic