WordPress.org

Support

Support » Miscellaneous » Permalink and paging

Permalink and paging

  • Hello wordpress scholars

    I made a theme and customized it with template pages 5 of them one of the pages has the name Blog, and in there I placed a wp query to show 8 posts per page bla bla ..I placed in the end of the page the next_posts_page() …(or wp-pagenavi) so the first 8 posts show correctly in the “Blog” page but the second (/page/2), third (/page/3), …(/page/n) page’s display the same as the the first 8 posts, they don’t display Older posts any more… it seems to be a problem with paging, I googled and search but nothing useful.

    Please help if you had the same issue or if you know the solution.

    Visar

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi
    Forum Moderator

    @esmi

    Setting up a new wp query can mess with the default paging as you’re essentially wiping all of the default query setting (including the paging) and replacing them with your custom arguments. Try something like:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'showposts' => 8,
    	'paged' => $paged
    );
    query_posts($args);
    ?>

    you are a genius thank you very much, so the function get_query_var() actually retrieves the query string from an URL and than you can process it to build a new query in the wp_posts… great this awesome.

    Esmi thank you for helping me in this, one more question how or where can I learn these tweaks of wordpress, this good understanding on how wordpress processes things?

    Anyway thanx you saved me a lot of time, I hope this solution will serve other wordpress users.

    Visar

    esmi
    Forum Moderator

    @esmi

    The Codex is the best place. You may have to run a few searches to find exactly what you need to know but it’s in there 90% of the time. Other than that, searching the forum to pick up tips and tricks. Any solutions posted by Otto, samboll or Michael H are well worth reading. For hack/security advice, look out for whooami.

    Hope that helps.

    just wanted to say thanks as i was having the same problem but could not find the answer then i stumbled on this page. worked perfectly!

    shkhurram
    Member

    @shkhurram

    I am using a premium theme by WordPress. When i use the custom settings for permanent Links, Paging stop working. Also, my paging style is Previious and Next Button where i would like to update it to Pahe Numbers like 1, 2,3 Next.

    Any thoughts?

    Khurram.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Permalink and paging’ is closed to new replies.