• Hi, Everyone,

    Thanks, Tom, for a great plugin.

    This plugin behaves like all sticky posts in WordPress – on a category page, it will display the sticky post both on the first page, and, assuming there are multiple pages and it’s not chronologically on the first, on in its chronological place on a later page.

    After a bit of Googling and hunting through this plugin’s code, I came up with the following to remove the duplicate category sticky post. On your category page, replace something like the following

    while (have_posts()) : the_post();
             the_content();

    with something like the following:

    global $paged;
    while (have_posts()) : the_post();
    //remove category sticky post after first page of results
    $postid = get_the_ID();
    if ($paged > 1) {
    	if (0==get_post_meta($postid, 'category_sticky_post', true )) {
     	 the_content();
     	 echo "<hr>";
     	}
    }else {
      the_content();
      echo "<hr>";
      } ?>

    I hope it helps someone. Feel free to improve it or make it more beautiful,

    Brit

    https://www.ads-software.com/plugins/category-sticky-post/

  • The topic ‘Remove Category Sticky Post after first page’ is closed to new replies.