WordPress.org

Forums

[resolved] Navigation doesnt work when using query_posts (5 posts)

  1. bitweb
    Member
    Posted 3 years ago #

    Hi,

    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

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    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'); ?>

    http://codex.wordpress.org/Function_Reference/query_posts

  3. bitweb
    Member
    Posted 3 years ago #

    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

  4. bitweb
    Member
    Posted 3 years ago #

    EDIT:
    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.

  5. bitweb
    Member
    Posted 3 years ago #

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

    http://wordpress.org/extend/plugins/ultimate-category-excluder/

Topic Closed

This topic has been closed to new replies.

About this Topic