Support » Fixing WordPress » Navigation doesnt work when using query_posts

  • Resolved bitweb



    I know this has been discussed many times, but I cant solve it anyway.

    I’m trying to exclude some categories from a page ( homepage in this case) but when I use query_posts to do it navigation doesnt work.

    How can I see the navigation and show only 5 posts ?

    here is my template code

    I tried many solutions but none worked

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael


    Forum Moderator

    what does not work?

    – no links?
    -> try to use the WordPress functions next_posts_link() and previous_posts_link()` to exclude plugin problems.

    – next-posts show first page again?
    -> try this alternative code:

    <?php global $query_string; query_posts($query_string . '$cat=-42'); ?>

    I can see the links, but they do not work properly, the send me to page 1 everytime.

    I tried the function next_posts_link() and previous_posts_link(), but the result is the same.

    tried the alternative code you gave me, now I only see the content of the page, not the posts.

    This is a page selected from wordpress interface as “homepage”, plus there is this custom template ( as you can see ) to show all the posts except the ones from cat 42.

    If I use your function I see the content of the page, not the posts

    If I select in the reading settings of wordpress interface the page as “blog page” I see articles from all the categories, it does not exclude the ones from cat 42

    I messed up something.
    with your alternative code, I see ALL articles in the page ( which is my homepage, a standard page selected as homepage with a custom template).
    If I click “next” I see the CONTENT of the page, not the page 2 of the articles.

    ok, I miserably solved the problem with an exclude category plugin:

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Navigation doesnt work when using query_posts’ is closed to new replies.