Custom sidebar not appearing – assigning to individual page
-
Hi,
I’d be grateful if you could point me in the right direction as to what is wrong!
I’ve assigned a test sidebar to a specific page but the standard primary sidebar appears.
I’ve used the plugin as a go to plugin before and come to use it now on a new build. I’m using WordPress 4.9.8, and roots sage 9 starter theme. It happens on localhost (MAMP PRO) and stage site – both on PHP 7. I’ve disabled other plugins but not finding any conflicts.
Steps:
1. installed the custom sidebars plugin
2. created a test sidebar
3. went to a page, and assigned new test sidebar as the replacement
4. view the same page to see that the sidebar is still showing default primary sidebarFunctions code:
/**
* Register sidebars
*/
add_action(‘widgets_init’, function () {
$config = [
‘before_widget’ => ‘<section class=”widget %1$s %2$s”>’,
‘after_widget’ => ‘</section>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
];
register_sidebar([
‘name’ => __(‘Primary’, ‘sage’),
‘id’ => ‘sidebar-primary’
] + $config);
register_sidebar([
‘name’ => __(‘Footer’, ‘sage’),
‘id’ => ‘sidebar-footer’
] + $config);
});Sidebar template code:
dynamic_sidebar(‘sidebar-primary’)
Thanks
- The topic ‘Custom sidebar not appearing – assigning to individual page’ is closed to new replies.