WordPress.org

Forums

Page navigation doesn't work any more (6 posts)

  1. levani01
    Member
    Posted 4 years ago #

    Please help, page navigation doesn't work on my blog any more. When I go to second page the same posts are shown. Nothing changes. What may cause this? Please help

    Thanks

  2. stvwlf
    Member
    Posted 4 years ago #

    Hi

    Most likely you are using a query_posts on that page. Change your query_posts code to include paging

    example:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
          query_posts("cat=1&amp;paged=$paged"); ?>

    You must use double quotes, not apostrophes, to surround the query_posts parameters

  3. stormbot
    Member
    Posted 3 years ago #

    @ stvwlf

    That works .... But I have another problem now...

    How do I use your code but exclude categories now?
    I wish to exclude category 7 and 15 for example.

    Can anyone help using code above?

    Kind Regards

  4. stormbot
    Member
    Posted 3 years ago #

    10 minutes later and I just figured it out with trial and error... Just pure guesses and it worked.

    Basically I wrote it like this:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string . '&cat=-7,-5&paged=' . $paged); ?>

    What worked was removing the "amp;" and leaving the "&"...also I placed the "&" in front of the cat.

    It was a pure guess...I really have no clue about php. At least it works now.

    thanks!!!

  5. thinkadrian
    Member
    Posted 3 years ago #

    I tried both

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts(array(
    		'cat' => 31,
    		'order'=>'DESC',
    		'paged'=>$paged,
    		'posts_per_page' => 10,
    ));

    and

    query_posts($query_string.'&cat='.$catID.'&paged='.$paged.'&posts_per_page='.$maxPosts);

    ($catID and $maxPosts set)

    still I'm taken back to index.php instead of a new category page. the URL is changed, though, to something that mght be correct...

  6. thinkadrian
    Member
    Posted 3 years ago #

    correction, I get a 404

Topic Closed

This topic has been closed to new replies.

About this Topic