Support » Fixing WordPress » Category Sticky

  • Resolved John Leschinski


    So here is what I’m trying to do.

    On the category archive pages I want to have sticky posts in that category appear at the top of the page and the paginated pages, and then follow that with the normal display of posts and pagination for that category.

    I figured I could do this with a post query to call the sticky, and then another query after to display the normal order of posts.

    I can’t seem to get the code quite right though. Anyone know of a better solution, or the right php to use to make this work?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This in a Category Template works to show the sticky posts for a given category:

    $cat = get_query_var('cat');
      'post__in' => $sticky,
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
        //this is necessary to show the tags
        global $wp_query;
        $wp_query->in_the_loop = true;

    Whats the easiest way to make posts Sticky for a category separate from the home page. I know I can hard code which post numbers I don’t want to show, but that’s not really an option I like.

    I have only one post I want sticky for the home page but other posts I want sticky in their category pages.

    Do we still need a plugin to accomplish this?

    I am looking for the same thing.

    I’m looking too

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category Sticky’ is closed to new replies.