Manage the number of post on homepage

Viewing 2 posts - 1 through 2 (of 2 total)
  • #20672
    andreas.ks
    Participant

    I want to manage the number of post that is shown on the homepage. I can manage the number of full post, but i also want to limit the small posts on the homepage. How is that possible?

    I dont have access to the editor, can only do css.

    Best,
    Andreas

    #20894
    Daniel Tara
    Keymaster

    It’s not possible to do this with just CSS. If you can insert some code, this function should do the job:

    add_action( 'pre_get_posts', 'pinboard_front_page_posts' );
    
    function pinboard_front_page_posts( $query ) {
    	global $wp_the_query;
    	if( $wp_the_query === $query && $query->is_home() ) {
    		$query->set( 'posts_per_page', 8 );
    	}
    }
    

    Replace the number 8 with your desired number of posts per page.

Viewing 2 posts - 1 through 2 (of 2 total)

Tagged: ,

You must be logged in to reply to this topic.