• 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

genesis_unregister_layout is not working

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 › genesis_unregister_layout is not working

This topic is: resolved

Tagged: 3rd parameter, add_action, priority

  • This topic has 5 replies, 3 voices, and was last updated 5 years, 2 months ago by seancwalsh.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 2, 2017 at 10:40 am #202347
    seancwalsh
    Member

    Hey,

    I am trying to learn how to build a genesis child theme from scratch. I am trying to remove some of the layout options, but it does not work and I cannot figure out why. Here is my code in functions.php:

    	function scratch_setup() {
    
    	define('CHILD_THEME_NAME', 'Scratch');
    	define('CHILD_THEME_URL', 'http://github.com/cdils/scratch');
    	define('CHILD_THEME_VERSION', '1.0.0');
    
    	//Add HTML5 Markup Structure
    	add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption'  ) );
    	
    	//Add viewport meta tag for mobile browsers
    	add_theme_support( 'genesis-responsive-viewport' );
    	
    	//Add theme support for accessibility
    	add_theme_support( 'genesis-accessibility', array(
    		'404-page',
    		'drop-down-menu',
    		'headings',
    		'rems',
    		'search-form',
    		'skip-links',
    		) );	
    
    	//Add theme support for footer widgets
    	add_theme_support('genesis-footer-widgets', 3 );
    
    
    	//unregister layouts that use secondary sidebar
    	genesis_unregister_layout( 'content-sidebar-sidebar' );
    	genesis_unregister_layout( 'sidebar-sidebar-content' );
    	genesis_unregister_layout( 'sidebar-content-sidebar' );
    
    }
    March 2, 2017 at 12:00 pm #202352
    Victor Font
    Moderator

    Where are you calling the function scratch_setup()? And why are you using that function? There's no need to wrap the code in a function.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    March 2, 2017 at 7:55 pm #202382
    seancwalsh
    Member

    Hi Victor,

    Thanks for your response. I am calling the function on the line above where I have declared it -

    add_action ( 'genesis_setup', 'scratch_setup' );

    Good question - I am actually following a tutorial at the moment and that is how it is done there. Whilst troubleshooting, I tried to move this code before and after this function, but it caused the site not to load, but I cannot yet figure out why.

    Thanks

    P.s - please excuse my ignorance! I have been editing php files in Genesis for a while now, but I have just started trying to write the code.

    March 2, 2017 at 8:07 pm #202384
    seancwalsh
    Member

    I have fixed the issue. It was an issue with the code for calling the function as you suggested. I needed to add 15 to the end of the function call. I am not 100% why this works. Something to do with the order in which the function is called?

    add_action ( 'genesis_setup', 'scratch_setup', 15 );

    Thanks for your help.

    March 2, 2017 at 8:54 pm #202386
    Brad Dalton
    Participant

    3rd parameter for priority

    Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
    Default value: 10


    2700 Genesis Tutorials

    March 2, 2017 at 9:17 pm #202387
    seancwalsh
    Member

    Great. Thank you.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 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

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