• hey guys,
    is there a plugin for handling the number of posts displayed on home page ??
    i know i can go to settings -> reading and from there i can control that but i don~t want that, i have woocommerce plugin and if i set the number of posts from reading then it will afect the number of item displayed in shop page

    i don~t want to edit the index.php of my theme
    i want a plugin because some days i need 4 posts on home page other times i need 10
    so … is there a plugin for what i want ??

Viewing 1 replies (of 1 total)
  • I think that pre_get_posts filter may work for you.
    Try adding this code at the end of the theme functions.php file

    function tas_limit_posts_homepage( $query ) {
        if ( $query->is_home() && $query->is_main_query()) {
            $query->set( 'posts_per_page', 10 );
            return;
        }
    }
    add_action( 'pre_get_posts', 'tas_limit_posts_homepage', 1 );
Viewing 1 replies (of 1 total)
  • The topic ‘number of posts on front page’ is closed to new replies.