• here is my code in functions.php

    function themename_widgets_init() {
    register_sidebar( array(
    'name' => __( 'Primary Sidebar', 'theme_name' ),
    'id' => 'sidebar-1',
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => '</aside>',
    'before_title' => '<h1 class="widget-title">',
    'after_title' => '</h1>',
    ) );

    }
    add_action( 'widgets_init', 'themename_widgets_init' );

    here is the code in my sidebar.php

    <div id="sidebar-primary" class="sidebar">
    <?php dynamic_sidebar( 'sidebar-1' ); ?>
    </div>
    and the code in my footer.php to display my sidebar:-

    <?php get_sidebar(); ?>
    When I am trying to customize the sidebar from dashboard there I am able to add and remove widgets but when I am trying to add widgets from live website(i.e from the left panel which provides options for customization and changes are appeared on the right panel at same time ) there I am getting this message ‘There are no widget areas on the page shown, however other pages in this theme do have them.’ So what is wrong that I am doing here that I am able to add widgets from dashboard and can’t add while customizing it on the live website ? Thanks in advance.

Viewing 1 replies (of 1 total)
  • My guess is that you have added the widget code onto one of the site sections i.e content.php and not the archives or something? But without seeing your site file list and/or template used I cannot comment any further. I would make sure that the widget code is added throughout your template.

Viewing 1 replies (of 1 total)
  • The topic ‘Can’t add widgets while customizing wordpress’ is closed to new replies.