• 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

Removing Loop on Home 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 › General Discussion › Removing Loop on Home Page

This topic is: not resolved

Tagged: Loop Removal, widgets

  • This topic has 3 replies, 2 voices, and was last updated 12 years, 8 months ago by brace1.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 22, 2013 at 6:30 am #58164
    brace1
    Member

    Hi everyone,

    I have created a widgetized home page (straight out of functions.php) that powers my seven-site network. You can see an example, (http://www.lasallehoops.com). I am running a customized sixteen-nine theme.

    The problem is that no matter how hard I try, I cannot remove the loop for the home page. I've tried simple things like

    if (is_home()) {
    
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    }

    As well as much more complex solutions. I've attached the widget part of my functions.php below:

    /** Register Top Featured widget area **/
    genesis_register_sidebar( array(
    'id'                => 'top-featured',
    'name'            => __( 'Top Featured Widget', 'sixteen-nine' ),
    'description'    => __( 'This is the Top Featured widget area which outputs on your blog page.', 'sixteen-nine' ),
    ) );
    
    add_action( 'genesis_before_loop', 'top_featured', 5 );
    function top_featured() {
    if ( is_home() && is_active_sidebar( 'top-featured' ) ) {
     echo '<div class="top-featured">';
    dynamic_sidebar( 'top-featured' );
    echo '</div><!-- end .top-featured -->';
    }}
    
    /** Register Second Featured widget area **/
    genesis_register_sidebar( array(
    'id'                => 'second-featured',
    'name'            => __( 'Second Featured Widget', 'sixteen-nine' ),
    'description'    => __( 'This is the Second Featured widget area which outputs on your blog page.', 'sixteen-nine' ),
    ) );
    
    add_action( 'genesis_before_loop', 'second_featured', 5 );
    function second_featured() {
    if ( is_home() && is_active_sidebar( 'second-featured' ) ) {
     echo '<div class="second-featured">';
    dynamic_sidebar( 'second-featured' );
    echo '</div><!-- end .second-featured -->';
    }}
    
    /** Register Bottom Featured widget area **/
    genesis_register_sidebar( array(
    'id'                => 'bottom-featured',
    'name'            => __( 'Bottom Featured Widget', 'sixteen-nine' ),
    'description'    => __( 'This is the Bottom Featured widget area which outputs on your blog page.', 'sixteen-nine' ),
    ) );
    
    add_action( 'genesis_before_loop', 'bottom_featured', 5 );
    function bottom_featured() {
    if ( is_home() && is_active_sidebar( 'bottom-featured' ) ) {
     echo '<div class="bottom-featured">';
    dynamic_sidebar( 'bottom-featured' );
    echo '</div><!-- end .bottom-featured -->';
    }}

    The solutions I've tried either don't work or remove the loop for everything. The problem with the loop is that I am getting a single duplicate post under my widgets from the loop. I thought I was getting good enough to do this but clearly was wrong.

    Thanks for any help.

    ~joe

    http://www.lasallehoops.com
    August 22, 2013 at 11:01 am #58224
    Robin
    Member

    Well, I could be wrong here, but what I see is that you're removing the loop but then adding actions before the loop. You want to remove your loop and do a custom loop.

    I don't know if it's best practices, or just another way of doing things, or what, but usually what I've done and seen done is to register your widget areas in your functions and then do your custom loop in a home.php or front-page.php. That way your work to add the widget areas to your home page don't have to have the is_home conditional.

    Hope that helps get you started--


    I do the best I can with what I’ve got. (say hey on twitter)

    August 22, 2013 at 3:28 pm #58277
    brace1
    Member

    Yeah, I built it a different way, but I think that is where we are heading.

    Thanks.

    August 22, 2013 at 4:22 pm #58294
    brace1
    Member

    So this is what I built, but there is an error somewhere:

    <?php 
    
    remove_action( 'genesis_loop', 'genesis_do_loop' ); 
    add_action( 'genesis_loop', 'child_home_loop_helper' ); // Execute custom child loop
    
    function child_home_loop_helper() { ?>
    
    <div class=“top-featured”>
                <?php if (!dynamic_sidebar(‘Top Featured’)) : ?>
                    <div class="widget">
     
                        <div class="wrap">
                            <p><?php _e("This is a widgeted area which is called Featured Top.”, 'genesis'); ?></p>
                        </div><!-- end .wrap -->
                    </div><!-- end .widget -->
                <?php endif; ?>
            </div><!-- end .top-featured -->
    
    <div class=“second-featured”>
                <?php if (!dynamic_sidebar(‘Second Featured’)) : ?>
                    <div class="widget">
     
                        <div class="wrap">
                            <p><?php _e("This is a widgeted area which is called Second Featured.”, 'genesis'); ?></p>
                        </div><!-- end .wrap -->
                    </div><!-- end .widget -->
                <?php endif; ?>
            </div><!-- end .second-featured-->
    
    <div class=“bottom-featured”>
                <?php if (!dynamic_sidebar(‘Bottom Featured’)) : ?>
                    <div class="widget">
     
                        <div class="wrap">
                            <p><?php _e("This is a widgeted area which is called Bottom Featured.”, 'genesis'); ?></p>
                        </div><!-- end .wrap -->
                    </div><!-- end .widget -->
                <?php endif; ?>
            </div><!-- end .bottom-featured-->
    <?php }
    
    genesis();
    
  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 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