[Support request] Displaying a dynamic sidebar

Home Forums Support [Support request] Displaying a dynamic sidebar

Home Forums Support Displaying a dynamic sidebar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #987113

    I’ve registered a new sidebar for an about section using the default wordpress code

    add_action( 'widgets_init', 'my_register_sidebars' );
    function my_register_sidebars() {
      /* Register the 'primary' sidebar. */
          'id' => 'about',
          'name' => __( 'About Sidebar' ),
          'description' => __( 'About section sidebar' ),
          'before_widget' => '<div id="%1$s" class="widget %2$s">',
          'after_widget' => '</div>',
          'before_title' => '<h3 class="widget-title">',
          'after_title' => '</h3>'
      /* Repeat register_sidebar() code for additional sidebars. */

    I showed the sidebar via a hook element and using the layout to display on the selected pages using the following content:

    <?php dynamic_sidebar( 'right-sidebar' ); ?>

    It works however I now have the default sidebar showing as well which I don’t need.

    How can I unregister the default sidebar and show only the about one? Is this the best way to do this or should I do it another way i.e via a template?

    I don’t want to use a plugin for the sidebars.



    Lead Developer
    Lead Developer

    Hi there,

    Have you considered using a plugin like this?: https://wordpress.org/plugins/content-aware-sidebars/

    It might simplify things.

    Let me know 🙂


    I have but I prefer to write the code and not use the plugins.

    Customer Support

    Then you might need to inspect the plugin code and see if you can write something similar.

    Providing custom solution like this when there is plugin already available is out of the scope of this forum unfortunately.

    The plugin should have minimal impact on your site.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.