Remove Genesis Layout Options

Genesis provides six different layout options with one, two, or no sidebars.

Most of the sites we build either have no sidebar or a single sidebar layout. We remove the unused layouts to keep the backend interface as simple as possible.

Here are two different ways to remove unused layouts.

Remove specific layouts

You can use the genesis_unregister_layout() function to remove a single layout. If the only layouts you want to keep are Full Width Content and Content Sidebar, you can add this to your theme:

// Remove unused sidebar
unregister_sidebar( 'sidebar-alt' );

// Remove unused layouts
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content' );

Remove all layout options

There’s no reason to display the Layout Settings when there aren’t multiple layouts to choose from. The following code:

  • Removes both sidebars
  • Removes all layouts except ‘full-width-content’
  • Removes the Layout Options metabox from the Edit Post / Page screen
  • Removes the Layout Options metabox from Genesis Archive Settings
// Remove unused sidebars
unregister_sidebar( 'sidebar' );
unregister_sidebar( 'sidebar-alt' );

// Remove layouts
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar' );

// Remove layout metaboxes
remove_theme_support( 'genesis-inpost-layouts' );
remove_theme_support( 'genesis-archive-layouts' );

// Use full width layout 
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. Phil says

    Thanks again for another great bit of Genesis goodness.
    in theory, at least: I’m probably doing something wrong, because when I remove the Genesis sidebars and all layouts as described above, suddenly the two standard sidebars/widget aeras stubbornly start showing up at the bottom of all my posts and pages.

    They’re not in active/visible the Widgets screen, so they simply show the default “Primary Sidebar Widget Area This is the Primary Sidebar Widget Area. You can add content …” text.

    Doing it the old-fashioned way of removing the sidebars and all sidebar layouts makes them disappear again; somehow the add_filter( ‘genesis_get_layouts’, ‘__return_empty_array’ ); bit makes Genesis act weirdly here.

    • Bill Erickson says

      Sorry about that, you’re right. Genesis loads the default widget area content when no layout is specified.

      I’ve updated the code to use the “old fashioned way” to prevent this issue.

  2. Joshua Nelson says

    This is a great snippet, Bill!

    For the “full removal” option, there is a site wide setting in customizer as well. I just filtered it out in this gist.

  3. Stuart says

    Is there a simple way to get this to working for the blog page (when set in settings > reading) and CPT archives?

    remove_theme_support( ‘genesis-archive-layouts’ );

    I still see the Layout Options metabox on my blog post archive page and CPT archive settings.

  4. Bill Erickson says

    For the first part (on the blog page), I’m not sure if there’s an easy way to remove that because it’s a page, not a CPT archive. You could probably hook into admin_head, look at the post ID in the URL, see if post ID = get_option( ‘page_for_posts’ ), and if so remove_meta_box(). But that seems like a big hassle.

    The CPT archive settings are typically added when you register the post type. Ex: register_post_type( 'event', [ 'supports' => [ 'genesis-layouts' ] ] );

    So check where you registered the post type and remove `genesis-layouts` from the `supports` array.