• 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 on home page only showing standard loop

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 › Grid loop on home page only showing standard loop

This topic is: resolved

Tagged: Genesis Grid Loop, home page

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 7 months ago by Semblance.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • August 21, 2013 at 3:37 pm #58030
    Semblance
    Member

    I'm using Genesis 2.0 and busy setting up a child theme - still very new to Genesis...

    I am using the following starter child theme: http://www.gregreindel.com/genesis-html5-child-starter-theme/
    In front-page.php there are added home page widgets. I've (tried) added the following grid loop code below the widgets, but before genesis(); - from the following link: http://my.studiopress.com/tutorials/genesis-grid-loop/

    Instead of showing the latest posts below the widgets, it just shows the standard loop from the home page. Eg. what ever text I have in the text area of the home page under Pages.

    Even after removing the widget code and try it with the grid loop only, it still only shows the standard loop content and not the grid loop content/latest posts. I have also changed the number of posts under Reading to be the same as in the loop.

    Do anyone have any idea to why it is doing this? Or what I am missing? Or perhaps a link to a very thorough explanation?

    http://local
    August 21, 2013 at 4:30 pm #58050
    Brad Dalton
    Participant

    Works for me:

    <?php
    
    add_action( 'genesis_meta', 'gregr_home_widget_test' );
    
    // Add widgets to homepage. If no widgets, then loop.
    function gregr_home_widget_test() {
    
    	if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) || is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) || is_active_sidebar( 'home-middle-3' ) || is_active_sidebar( 'home-bottom' ) ) {
    
    		remove_action( 'genesis_loop', 'genesis_do_loop' );
    		add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
    		add_action( 'genesis_after_header', 'gregr_home_do_featured' );		
    		add_action( 'genesis_after_header', 'gregr_home_do_middle' );
    		add_action( 'genesis_after_header', 'gregr_home_do_bottom' );
    	}
    }
    
    // Home feature widget section
    function gregr_home_do_featured() {
    
    	if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
    
    		echo '<section id="home-featured" class="clearfix"><div class="wrap">';
    		
    			genesis_widget_area( 'home-featured-full', array(
    				'before' => '<main class="home-featured-full">',
    				'after' => '</main>',
    
    			) );
    			
    		echo '<section id="home-featured-halves">';
    			
    			genesis_widget_area( 'home-featured-left', array(
    				'before' => '<aside class="home-featured-left one-half first">',
    				'after' => '</aside>',
    			) );
    			
    			genesis_widget_area( 'home-featured-right', array(
    				'before' => '<aside class="home-featured-right one half">',
    				'after' => '</aside>',
    			) );
    
    		echo '</section><!-- end home-featured-halves --></div><!-- end wrap --></section><!-- end home-featured -->'."\n";
    	}	
    }
    
    
    // Home middle widget section
    
    function gregr_home_do_middle() {
    
    	if ( is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) || is_active_sidebar( 'home-middle-3' )  ) {								
    		
    		echo '<section id="home-middle" class="clearfix"><div class="wrap">';
    		
    			genesis_widget_area( 'home-middle-1', array(
    				'before' => '<aside class="home-middle-1 widget-area">',
    				'after' => '</aside>',
    			) );
    			
    			genesis_widget_area( 'home-middle-2', array(
    				'before' => '<aside class="home-middle-2 widget-area">',
    				'after' => '</aside>',
    			) );
    			genesis_widget_area( 'home-middle-3', array(
    				'before' => '<aside class="home-middle-3 widget-area">',
    				'after' => '</aside>',
    
    			) );									
    		
    		echo '</div><!-- end wrap --></section><!-- end home-middle -->'."\n";			
    	}		
    }
    
    
    
    
    // Home bottom widget section
    
    function gregr_home_do_bottom() {
    
    	if ( is_active_sidebar( 'home-bottom' ) ) {								
    	
    		echo '<section id="home-bottom" class="clearfix"><div class="wrap">';
    		
    			genesis_widget_area( 'home-bottom', array(
    				'before' => '<aside class="home-bottom">',
    			) );
    		
    		echo '</div><!-- end .wrap --></section><!-- end #home-bottom -->'."\n";
    	}
    }
    
    add_action( 'genesis_loop', 'child_grid_loop_helper' );
    function child_grid_loop_helper() {
      if ( function_exists( 'genesis_grid_loop' ) ) {
    		genesis_grid_loop( array(
    			'features' => 1,
    			'feature_image_size' => 0,
    			'feature_image_class' => 'alignleft post-image',
    			'feature_content_limit' => 300,
    			'grid_image_size' => 'grid-thumbnail',
    			'grid_image_class' => 'alignleft post-image',
    			'grid_content_limit' => 120,
    			'more' => __( '[Continue reading...]', 'genesis' ),
    		) );
    	} else {
    		genesis_standard_loop();
    	}
    }
    
    
    
    genesis();
    

    Did you add the CSS to your child themes style.css file?


    Tutorials for StudioPress Themes.

    August 21, 2013 at 4:47 pm #58058
    Semblance
    Member

    Hello Brad.
    Thanks for posting the code. Yes, that is exactly what I have in the front-page.php.
    But... just realised... I have (had) a home page created under Pages.
    And had that page set as the static Front Page under Reading. Changing it back to posts solved the issue.
    Guess I just needed to talk to someone about it 😉
    Thanks again!

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Grid loop on home page only showing standard loop’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 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