• 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

Multiple Grid Loops on home page no longer working in 1.9x

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 › Multiple Grid Loops on home page no longer working in 1.9x

This topic is: not resolved
  • This topic has 1 reply, 2 voices, and was last updated 13 years ago by Jen Baumann.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 14, 2013 at 9:44 pm #11993
    nkohler
    Member

    Hello!

    Previously in Genesis 1.8x I was using multiple custom grid loops to display recent posts on the home page, broken out in sections, each containing recent posts from a different category.

    To accomplish this I did the following:


    function child_maybe_do_grid_loop() {

    // Amend this conditional to pick where this grid looping occurs
    if ( ! is_single() && ! is_page() && ! is_archive() && ! is_search() ) {

    // Remove the standard loop
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    // Add another prepared grid loop
    add_action( 'genesis_loop', 'child_do_grid_loop_cat1' );
    // Add another prepared grid loop
    add_action( 'genesis_loop', 'child_do_grid_loop_cat2' );
    // Add another prepared grid loop
    add_action( 'genesis_loop', 'child_do_grid_loop_cat3' );
    // Add another prepared grid loop
    add_action( 'genesis_loop', 'child_do_grid_loop_cat4' );
    // Use the prepared grid loop
    add_action( 'genesis_loop', 'child_do_grid_loop' );

    // Add some extra post classes to the grid loop so we can style the columns
    add_filter( 'genesis_grid_loop_post_class', 'child_grid_loop_post_class' );
    }
    }

    In each loop I would have custom arguments for each section like this:


    function child_do_grid_loop_cat1() {

    global $query_string, $paged;

    // Ensure the arguments for the normal query for the page are carried forwards
    // If you're using a Page to query the posts (e.g. with the Blog template), comment out the next line.
    wp_parse_str( $query_string, $query_args );

    // Create an array of arguments for the loop - can be grid-specific, or
    // normal query_posts() arguments to alter the loop
    // Cupcakes Category
    $grid_args = array(
    'features' => 0,
    'feature_image_size' => 'grid-featured',
    'feature_image_class' => 'alignleft post-image',
    'feature_content_limit' => 250,
    'grid_image_size' => 'grid-thumbnail',
    'grid_image_class' => 'alignleft post-image',
    'grid_content_limit' => 150,
    'more' => __( 'Continue reading →', 'genesis' ),
    'cat' => '5',
    'posts_per_page' => 3,
    );

    // Make sure the first page has a balanced grid
    if ( 0 == $paged )
    // If first page, add number of features to grid posts, so balance is maintained
    $grid_args['posts_per_page'] += $grid_args['features'];
    else
    // Keep the offset maintained from our page 1 adjustment
    $grid_args['offset'] = ( $paged - 1 ) * $grid_args['posts_per_page'] + $grid_args['features'];

    // Merge the standard query for this page, and our preferred loop arguments
    genesis_grid_loop( array_merge( (array) $query_args, $grid_args ) );

    }

    Now I have been reading that this method has been changed or depreciated with Genesis 1.9x. I have seen the new code and understand how I could use it to display only one category on the home page in a grid, but I do not know how to manipulate the code to accomplish what I had going on before which is multiple grid loops on the home page displaying different categories.

    Anyone have any ideas?

    Thanks in advance!

    Neil

    January 17, 2013 at 5:35 pm #12750
    Jen Baumann
    Participant

    Take a look here: http://wpsmith.net/2013/genesis/genesis-grid-loop-in-genesis-1-9/

  • 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