Support » Plugin: Custom Sidebars - Dynamic Widget Area Manager » Custom sidebar not appearing – assigning to individual page

  • Resolved kworrall

    (@kworrall)


    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 sidebar

    Functions 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

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom sidebar not appearing – assigning to individual page’ is closed to new replies.