Forums

Sticky posts not acting as expected in query_posts() (2 posts)

  1. ccloskey
    Member
    Posted 2 weeks ago #

    This is in WP 2.8.5 -- that version isn't currently available in forum dropdown.

    I'm trying to make a category template, showing all the posts in one category with paging to older/newer posts. I also want sticky posts to show up first.

    I had thought this was how query_posts() would work by default. Here's the code I'm using (adapted from the codex):

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
    'category_name'=>'news',
    'paged'=>$paged,
    );
    query_posts($args);
    ?>

    Instead of showing what I intended, this ignores the sticky characteristic and shows the posts in reverse date order. I had thought I needed to include the argument caller_get_posts set to 1 to ignore the sticky setting, but this isn't working that way.

    Am I misunderstanding the codex doc on caller_get_posts and query_posts? Or are sticky posts really not sticky?

    Thanks for your help.

  2. stvwlf
    Member
    Posted 2 weeks ago #

    Sticky posts only work on the home page. A category page is not the home page.

Reply

You must log in to post.

About this Topic