Community Forums › Forums › Archived Forums › Design Tips and Tricks › Grid loop on home page only showing standard loop
Tagged: Genesis Grid Loop, home page
- This topic has 2 replies, 2 voices, and was last updated 11 years, 7 months ago by
Semblance.
-
AuthorPosts
-
August 21, 2013 at 3:37 pm #58030
Semblance
MemberI'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://localAugust 21, 2013 at 4:30 pm #58050Brad Dalton
ParticipantWorks 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?
August 21, 2013 at 4:47 pm #58058Semblance
MemberHello 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! -
AuthorPosts
- The topic ‘Grid loop on home page only showing standard loop’ is closed to new replies.