• 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 https://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=https://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 . a€?&YOUR QUERY_POST STRINGa€?);

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

    query_posts($query_string . a€?&orderby=datea€?);

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dbasulto

    (@dbasulto)

    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.

    gerld

    (@gerld)

    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

    ?

    gerld

    (@gerld)

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

    Chris_K

    (@handysolo)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Paged navigation broken after query_post’ is closed to new replies.