Maybe I’m completely misunderstanding something about the sticky posts functionality, but for the life of me I can’t get sticky posts to float up/stick to the top when I query posts by category before the loop. I’ve looked through all the sticky post documentation/posts and don’t understand what I’m doing wrong.
For example, in my blog homepage (index.php) I’ve added
query_posts('category_name=news');just before the main loop. I have a post mapped to the news category and also set to sticky. When viewing the site homepage the post doesn’t stick to the top; instead it shows up in the proper chronological order further down the page. If I remove the
query_postscall, the post sticks correctly, but the loop also shows a bunch of non “news” posts that I don’t want to display.
My goal for the blog homepage is to only show posts from the News category and make sure any sticky posts in the News category are stuck to the top of the homepage (as well as the related category page).
Am try to do something that isn’t possible in one loop? Is there a better way to accomplish my goal?
Thanks for the help!
- The topic ‘Sticky posts not “sticking” when using query_posts()’ is closed to new replies.