WordPress.org

Ready to get started?Download WordPress

Forums

Paged navigation broken after query_post (5 posts)

  1. dbasulto
    Member
    Posted 8 years ago #

    Hi,

    im using query post to exclude a category. i got this before the loop:

    <?php query_posts('cat=-37'); // exclude curses ?>

    and it hides the posts from that category. but if i click on the "next page" link at the botton, i get http://myblog/page/2/ but the contents are the same as the main page. and so on if i go to page 3,4,5,6...
    so i found that query post actually has problems with paged navigation, but i found this on a <url=http://ifelse.co.uk/archives/2005/04/08/query_posts-redux/>blog</url>:

    Actually, a quick google search has revealed the following solution to the lack of paging when using query_posts():

    query_posts($query_string . ‘&YOUR QUERY_POST STRING’);

    if you wanted to simply get the default Loop after running a previous query_posts(), use:

    query_posts($query_string . ‘&orderby=date’);

    but i have no idea on how to implement this. i tried with 'cat=-37&orderby=date' but still no work.
    any ideas?

  2. dbasulto
    Member
    Posted 8 years ago #

    Also, if i click on comments, it shows me the main page with all the full articles (including the text after the more tag)...
    if i remove the query_post line i used, everything goes back to normal.

  3. gerld
    Member
    Posted 7 years ago #

    i am having this exact same problem.. and am not sure how to fix it.

    i want to run a query_post BEFORE the main loop, but whenever i run one the main loop also takes the commands as the 1st query_post

    how can i

    run query_post,
    then set it back to default and then run the main loop

    ?

  4. gerld
    Member
    Posted 7 years ago #

    i guess basically i want to be able to run the loop twice on the page with different results. is this possible?

  5. Chris_K
    Member
    Posted 7 years ago #

    Yes, it is possible. In fact, there are examples on The_Loop page in the codex.

    Also see the doc for query_posts.
    Read the "Usage" section carefully.

Topic Closed

This topic has been closed to new replies.

About this Topic