• 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

Respecting Genesis layout options in Woocomerce

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 › Respecting Genesis layout options in Woocomerce

This topic is: not resolved

Tagged: layout, WooCommerce

  • This topic has 3 replies, 2 voices, and was last updated 9 years, 3 months ago by Brad Dalton.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 1, 2016 at 10:58 pm #190619
    gregnumber1man
    Member

    Hi.

    Please bear with me on this one.

    In the Genesis Connect for Woocommerce plugin, in archive-product.php, the following code allows the user to set the layout for the shop archive pages within the shop Edit Page screen.

    add_filter( 'genesis_pre_get_option_site_layout', 'genesiswooc_archive_layout' );
    function genesiswooc_archive_layout( $layout ) {
    	global $shop_page_id;
    	$layout = get_post_meta( $shop_page_id, '_genesis_layout', true );
    	return $layout;
    }

    However, this code ignores the 'Default Layout set in Theme Settings' radio button. If this radio button is selected, the theme's default layout setting is used, not the user selected layout on the 'Theme Settings' page.

    My inital solution to this issue is to replace the code in question with the following:

    add_filter( 'genesis_pre_get_option_site_layout', 'my_function' );
    function my_function( $layout ) {
    	global $shop_page_id;
    	if ( get_post_meta( $shop_page_id, '_genesis_layout', true ) == null ) {
    		$layout = genesis_site_layout();
    		return $layout;
    	} else {
    		$layout = get_post_meta( $shop_page_id, '_genesis_layout', true );
    		return $layout;
    	}
    }

    However, this returns a 503 error. "503. Service Unavailable. The server is temporarily busy, try again later! Proudly powered by LiteSpeed Web Server".

    The following code bypasses the error:

    if ( get_post_meta( $shop_page_id, '_genesis_layout', true ) == null ) {
    	add_filter( 'genesis_pre_get_option_site_layout', genesis_site_layout() );
    } else {
    	add_filter( 'genesis_pre_get_option_site_layout', 'my_function' );
    }
    function my_function( $layout ) {
    	global $shop_page_id;
    	$layout = get_post_meta( $shop_page_id, '_genesis_layout', true );
    	return $layout;
    }

    ************************************

    In summary, why does this work:

    add_filter( 'genesis_pre_get_option_site_layout', genesis_site_layout( ) );

    ...while this generates a 503 error:

    add_filter( 'genesis_pre_get_option_site_layout', 'my_function' );
    function my_function( ) {
    	return genesis_site_layout( );
    }

    Thanks.

    August 2, 2016 at 12:31 am #190621
    Brad Dalton
    Participant

    Did you copy the folder over to your child theme or are you modifying the plugin code?


    Tutorials for StudioPress Themes.

    August 2, 2016 at 1:24 am #190625
    gregnumber1man
    Member

    Hi Brad,

    Thanks for your reply.

    I have tried both methods.

    If I completely uninstall the plugin, I can replicate the issue by creating a my-child-theme/woocommerce/archive-product.php file.

    Here are the contents of that file which will generate the 503 error:

    <?php
    
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    add_action( 'genesis_loop', 'woocommerce_content' );
    
    add_filter( 'genesis_pre_get_option_site_layout', 'my_function' );
    function my_function( $layout ) {
    	global $shop_page_id;
    	if ( get_post_meta( $shop_page_id, '_genesis_layout', true ) == null ) {
    		$layout = genesis_site_layout();
    		return $layout;
    	} else {
    		$layout = get_post_meta( $shop_page_id, '_genesis_layout', true );
    		return $layout;
    	}
    }
    
    genesis ();

    If I replace the code above with the following code, everything works fine:

    <?php
    
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    add_action( 'genesis_loop', 'woocommerce_content' );
    
    if ( get_post_meta( get_option( 'woocommerce_shop_page_id' ), '_genesis_layout', true ) == null ) {
    	add_filter( 'genesis_pre_get_option_site_layout', genesis_site_layout() );
    } else {
    	add_filter( 'genesis_pre_get_option_site_layout', 'my_function' );
    }
    
    function my_function( $layout ) {
    	$layout = get_post_meta( get_option( 'woocommerce_shop_page_id' ), '_genesis_layout', true );
    	return $layout;
    }
    
    genesis();

    What I would like to know is: why am I getting a 503 error using the first method?

    Regards,

    Greg

    August 2, 2016 at 7:53 am #190644
    Brad Dalton
    Participant

    Can't you add 1 line of PHP like this to the template file:

    add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );

    Tutorials for StudioPress Themes.

  • 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

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