• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Number of blogposts on page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Number of blogposts on page

This topic is: resolved
  • This topic has 6 replies, 3 voices, and was last updated 13 years, 3 months ago by Jared Williams.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • March 20, 2013 at 6:44 am #29665
    normanviss
    Member

    I am using Education theme.

    I would like only one blogpost on the Home Page - the most recent one.

    Then when a visitor clicks on 'older posts', I'd like them to see a list of posts (5 or 6) instead of just one.

    Can anyone give me a tip on how to do that?

    Thx!

    My url is: http://expateverydaysupportcenter.com/

    March 20, 2013 at 7:54 am #29679
    Jared Williams
    Member

    This can be done but will require some mods to your functions.php file.

    In your functions.php file you need to add this code that was adapted from Bill Erickson's post on Customizing The WordPress Query

    add_action( 'pre_get_posts', 'be_change_event_posts_per_page' );
    /**
     * Change Posts Per Page for Event Archive
     * 
     * @author Bill Erickson
     * @link http://www.billerickson.net/customize-the-wordpress-query/
     * @param object $query data
     *
     */
    function be_change_event_posts_per_page( $query ) {
    	
    	if( $query->is_main_query() && !is_admin() && $query->is_home() ) {
    		$query->set( 'posts_per_page', '1' );
    	}
     
    }

    You see this line:

    $query->set( 'posts_per_page', '1' );

    '1' is saying that we want 1 post to show on the home page. If you wanted 6, you would change the number.

    You will then need to go into your Settings --> Reading and select the number of posts you would like to show up on the following pages. It defaults to 10.

    I have tested this on an install of Education and it works.

    Hope this helps!


    Website | Twitter | Instagram | Google +

    March 20, 2013 at 8:34 am #29689
    normanviss
    Member

    Thanks, Jared,

    I added this code to functions.php (at the bottom)

    and now the site doesn't work at all . I removed the code, and the site still doesn't work.

    Ideas?

    
    add_action( 'pre_get_posts', 'be_change_event_posts_per_page' );
    /**
     * Change Posts Per Page for Event Archive
     *
     * @author Bill Erickson
     * @link <a href="http://www.billerickson.net/customize-the-wordpress-query/" rel="nofollow">http://www.billerickson.net/customize-the-wordpress-query/</a>
     * @param object $query data
     *
     */
    function be_change_event_posts_per_page( $query ) {
    
        if( $query->is_main_query() && !is_admin() && $query->is_home() ) {
            $query->set( 'posts_per_page', '1' );
        }
    
    }
    
    March 20, 2013 at 8:43 am #29695
    normanviss
    Member

    OK.

    I removed that piece from the ftp files, so the site is up again.

    But I must be doing something wrong.

    Any suggestions are welcome.

    Thx!

    March 20, 2013 at 10:37 am #29720
    Susan
    Moderator

    Have you tried Bill Erickson's Grid Loop plugin? You can customize how many features and excerpts appear on the front page, and on internal pages. I have just done it with a site I'm working on - my home page has one excerpt, and the internal pages have 6 excerpts each.

    March 20, 2013 at 11:36 am #29734
    normanviss
    Member

    Thanks Susan - works great!

     

    Norman

    March 21, 2013 at 8:04 am #29933
    Jared Williams
    Member

    Sorry that did not work out for you. I'm not sure what the issue was since I tested on an install of Education. Glad you found Bill's other solution!


    Website | Twitter | Instagram | Google +

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble