WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] posts per page (7 posts)

  1. trancebrothers
    Member
    Posted 1 year ago #

    http://trancebrothers.vacau.com/2012/09/

    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
    Member
    Posted 1 year 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() )
            return;
    
        $query->set( 'posts_per_page', 20 );
    
    }
    
    add_action( 'pre_get_posts', 'trance_posts_per_page' );
  5. trancebrothers
    Member
    Posted 1 year ago #

    ohhh finally!!!

    it results :D

    thank you very much Chris!!

  6. Edde Beket
    Member
    Posted 1 year ago #

    You could use query_posts( 'posts_per_page=20' )

    See Function Reference/query posts

    OK, that was fashionably late ;-)

  7. trancebrothers
    Member
    Posted 1 year 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