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:
- One to remove the sidebar if its been created using the Genesis Simple Sidebars plugin
- 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' ),
) );
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.
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.