[resolved] posts per page (7 posts)

  1. trancebrothers
    Posted 3 years ago #


    In the link above I want change the number of posts to 20 per page..

    How can I get this??

    I read about query_posts but it doesn't work!!

    help me please, I'll appreciate...

    thanks a lot

  2. Posts per page can be changed globally by going to settings -> reading and entering 20 for the default how many posts per page to show.

    You can also use the pre_get_posts() filter if you are experienced with PHP and comfortable making code changes and additions to your site.

  3. trancebrothers
    Posted 3 years ago #

    thanks a lot for the answer but I want change only in this page above!! not globally!!

    I'm not experienced with PHP, I need help in the code to change the problem!

  4. You can add the following to your functions.php file. What this does is modify the posts per page setting on any monthly date archive.

    function trance_posts_per_page( $query ) {
        if (! is_main_query() || ! $query->is_month() )
        $query->set( 'posts_per_page', 20 );
    add_action( 'pre_get_posts', 'trance_posts_per_page' );
  5. trancebrothers
    Posted 3 years ago #

    ohhh finally!!!

    it results :D

    thank you very much Chris!!

  6. Edde Beket
    Posted 3 years ago #

    You could use query_posts( 'posts_per_page=20' )

    See Function Reference/query posts

    OK, that was fashionably late ;-)

  7. trancebrothers
    Posted 3 years ago #

    sorry for the question, but where I put this code? in the function.php too?

    Anyway, the problem is solved :)

    thanks a lot guys! you really help me

Topic Closed

This topic has been closed to new replies.

About this Topic