• 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

Grid Loop – Different number of columns

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 › General Discussion › Grid Loop – Different number of columns

This topic is: not resolved

Tagged: Columns, grid loop

  • This topic has 1 reply, 2 voices, and was last updated 10 years ago by Victor Font.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • December 18, 2015 at 7:29 am #174198
    dire
    Member

    I'm using the Genesis Grid plugin. I need to display a different number of columns if the page is not the blog/home page (i.e., a certain category archive page).

    Right now I've got 3 columns on the blog page, but I need 4 on another page. Can I do this with a function/hook? I'm thinking I would need to change the $columns number, as seen here: https://gist.github.com/billerickson/1552401/f66f2f84337bf124a749654f39a722873f51ded3 but I'm not sure how. Would I have to remove the loop and create a different one? Is it possible to change just the number of columns?

    Thank you.

    December 19, 2015 at 7:12 am #174323
    Victor Font
    Moderator

    In Bill's code, he's changing the number of columns based on the paging. You would need to test for the actual pageid. Wrap your code in an if statement where is_page( '1' ) is the page number of the one you want 4 columns. Modifying Bill's code, it would look like this:

    function child_modify_query( $query ) {
    	// Only apply to the main query
    	if( $query->is_main_query() ) {
    		// Use the same conditional you used in child_maybe_grid_loop()
    		if( is_page( '1' ) ) {
    			// Number of posts to show on subsequent pages (just grid)
    			$query->set( 'posts_per_page', '4' );		
    		else
    			// Number of posts to show on first page (grid + features)
    			$query->set( 'posts_per_page', '3' );
    		}
    	}
    }

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ 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