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:

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:


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


Comments

2 responses to “Add Custom Sidebar & Remove Primary Sidebar in Genesis”

  1. 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.

    1. Brad Dalton Avatar
      Brad Dalton

      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.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.