Support » Themes and Templates » Sticky post isn’t that sticky at all…

  • Is there a bug or why I can’t get this simple query_posts to show my sticky posts in my new theme? I even tried putting it in on the default theme and it still doesn’t show the sticky post on top.

    <?php query_posts('cat=5,6,7'); ?>
    <?php if (have_posts()) : ?>
    	<?php while (have_posts()) : the_post(); ?>
    		<!-- post content -->
    	<?php endwhile; ?>
    <?php else : ?>
      	<!-- error -->
    <?php endif; ?>
Viewing 8 replies - 1 through 8 (of 8 total)
  • Is the sticky post in category 5, 6, or 7?

    Sticky posts are only sticky on normal blog index pages. You’re reworking the query to ask for a category archive, which is something different and which is not normally where you’d want stickies to show up.

    Yeah sticky posts are in categories 5,6 and 7. I only want to show those categories in the frontpage (index.php). Do I misunderstand the Codex then?

    Return ALL posts with the category, but don't show sticky posts
    at the top. The 'sticky posts' will still show in their natural
    position (e.g. by date):

    I get the impression that without caller_get_posts parameter sticky posts will show up at the top.

    I have been trying to work this one out to, but it doesn’t appear stickies take priority once you perform any custom category selection on the main page..

    The query is designed to handle stickies only on the main page as far as i can work out.. but that no longer works when you start filtering the category selection.

    Happy to be wrong if someone can show otherwise..

    I’ve looked through the codebase.

    Sticky posts *only* appear on the is_home() page. Since you changed the main query to be a is_category() page, it’s not an is_home() query and you don’t get the stickies.

    The codex may be wrong, I have not examined it.

    Perhaps a feature request is in order then…

    Category level stickies… 🙂

    Thanks for the info. Disappointing, but good to know.

    I ran into this problem, too. I was trying to print either the most recent post or the sticky post in category 5. I came up with a solution that is probably not the most elegant in the world, but it works. Here’s how I got around it:

       'post__in' => $sticky,
    if (!have_posts() )
      {query_posts('cat=5&showposts=1'); }

    So, only way is first import all sticky posts, and then query all other non sticky?

    I will try like topic starter query posts from category to home page (index), and have no success.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Sticky post isn’t that sticky at all…’ is closed to new replies.