• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Add Custom Sidebar & Remove Primary Sidebar in Genesis

This code enables you to replace your primary sidebar with a custom sidebar widget area.

You can add this PHP code to any template file like a:

  • single.php file
  • category.php file
  • archive-cpt.php file

You can add the following code directly to any template file.

Here’s the code that works with Genesis however it can be easily modified to work with any theme:

Register for full access


The above code includes 2 remove actions:

  1. One to remove the sidebar if its been created using the Genesis Simple Sidebars plugin
  2. And a second remove action to remove the default primary sidebar.

If you aren’t using the GSS plugin, you can remove the action for ss_do_sidebar.

You’ll also need to add the following PHP code to your functions file to register a widget area for your custom sidebar:

genesis_register_sidebar( array(
	'id'          => 'wpsites-custom-sidebar',
	'name'        => __( 'Custom Sidebar', 'wpsites-education' ),
	'description' => __( 'This is your custom sidebar widget area.', 'wpsites-education' ),
) );

Related Tutorials

  • Genesis: 3 Ways To Remove The Primary Sidebar From Single Pages
  • Remove Sidebar On Genesis Home,Page or Posts

Custom Sidebar

Reader Interactions

Comments

  1. marielle says

    December 19, 2016 at 8:33 am

    Hi Brad:
    I have removed both the the primary and secondary sidebars in the Genesis Sample theme for a blog customizations project I am working on. I have registered sidebar widgets called sidebar-home-sidebar, page sidebar, blog sidebar and store sidebar but I cannot get the page and store sidebar widgets to show up on their correct respective pages. I have been able to get the sidebar home sidebar and blog sidebar widgets to correctly show so I am not sure what I am doing wrong here. Can you please help me with this.

    Thanks.

    Log in to Reply
    • Brad Dalton says

      December 19, 2016 at 3:53 pm

      Hello Marielle

      Store sidebar? Are you using a plugin to generate the store?

      Also page sidebar. Which page are you referring to specifically?

      Please link to both pages.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags