Forums

query_posts and sticky posts problem (9 posts)

  1. ivan2704
    Member
    Posted 8 months ago #

    Hi folks, I have problem with query_posts command and sticky posts. I am using custom twentyten child theme and in themes index.php I inserted this code
    if ( is_home() ) {query_posts($query_string.'&cat=3');}
    so only one category is on the front page. So my problem is when I make post sticky nothing happens. Post remains on it's place.
    I tried removing that code and then it was OK. But i need this because I want to show only one category on front page. Does anybody have a solution for my problem? Thanks

  2. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    Try:

    if ( is_home() ) {query_posts($query_string.'&cat=3&ignore_sticky_posts=0');}

  3. ivan2704
    Member
    Posted 8 months ago #

    It's not working :(

  4. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    You may have to write a full custom query instead of concatenating onto the existing query.

  5. ivan2704
    Member
    Posted 8 months ago #

    I was searching the google a little bit now and I realized that this won't be so easy to fix :D. Life is hard :P

  6. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    Is the sticky post in category 3?

  7. ivan2704
    Member
    Posted 8 months ago #

    Yes it is :) It is my news category

  8. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    You could try doing this using two Loops - the first pulling in the sticky post and the second pulling in all of the other posts in category 3.

  9. ivan2704
    Member
    Posted 8 months ago #

    It seems that is only possible way. Thank you for your answers. If anybody comes up with something else, write it :)

Reply

You must log in to post.

About this Topic