Forums

Making 1 category of posts sticky when using multiple cats. in archives. (2 posts)

  1. tim0thyb
    Member
    Posted 9 months ago #

    Under my category archive pages, some posts are listed in multiple categories. I'd like to be able to have one particular category's posts to show up as sticky on top of the specific category archive page and then the rest of the posts from that category page show up randomly so that they rotate below the sticky posts above. Two different categories(or more), one particular category on top

    For example, say that some posts are listed under the cats category as well as the dogs category. On the dog category page, how do I make posts from the cat category show up above the dog posts, which are randomly rotated underneath?

    Hope this isn't too confusing.. I've been looking at wp-queries and drawing a blank..

  2. tim0thyb
    Member
    Posted 9 months ago #

    These are the two queries I found but something doesn't seem to work..

    <?php query_posts( array( 'category__and' => array(134), 'orderby' => 'title', 'order' => 'DESC' ) );?>

    <?php global $query_string; query_posts( $query_string . '&orderby=rand' );?>
    <?php while (have_posts()) : the_post(); ?>

    The top query is for the cats to show up on top in descending order by title.
    The bottom is for the posts listed under the dog category to show up randomly beneath.

Reply

You must log in to post.

About this Topic