• Hi there,

    For some reason, the Category Posts Widget plugin is ignoring ‘sticky’ and ‘announcement’ posts as implemented in WP-Sticky. See https://preview.austinrwa.org/ for an example. In the sidebar, the top “Next Meeting’ area is populated using Category Posts; the bottom “Next Meeting?” area is a test case populated using the built-in WordPress Recent Posts widget. I’ve set the May 2008 meeting post to be an ‘announcement’. Recent Posts sees the sticky status fine, but Category Posts isn’t registering it.

    Any ideas on how to fix? I tried porting the query code over from Recent Posts and mucking with it, but only succeeded in blowing things up. Thanks for any help you can lend me!

Viewing 1 replies (of 1 total)
  • wordpress 2.7 by default has the ‘sticky’ option, but it is still ignored by the category posts plugin. I have modified the plugin to support stickies:

    replace cat-posts.php, line 40 with this:

    $cat_sticky = get_posts(array('post__in'=>get_option('sticky_posts'),'category'=>$cat_id));
    if($cat_sticky[0]){
    	$num -= count($cat_sticky);
    }
    $cat_nonSticky = get_posts(array('post__not_in'=>get_option('sticky_posts'),'category'=>$cat_id,'numberposts'=>$num));
    $cat_posts = array_merge($cat_sticky,$cat_nonSticky);

    This way, all the stickies from the category will be read first, then all the ‘non-stickies’

    Hope it works for you

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Category Posts Widget] Category Posts Plugin ignoring ‘sticky’ posts’ is closed to new replies.