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' ),
) );
Was This Tutorial Helpful?