Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #14467

    Hi guys,

    I ran into the same problem as another user but that thread is closed: http://www.kriesi.at/support/topic/multiple-sidebar-instead-of-one.

    The problem I’m having is that I want a certain page to have a unique sidebar. When I create one using the theme options and I add some things in the newly created widget area, I find that all of the items that I have in my “display pages” widget area show up in addition to the newly created sidebar.

    Of course, I don’t want this. I only want my newly created sidebar area to show up and not both. I followed Kriesi’s directions that are listed in the link above however, I found that it removed all of my sidebars on my website. I think the part that might have been confusing for me was where Kriesi says to do something on line 93. I wasn’t sure what to do in that part.

    Can you please help?

    #83576

    Any updates on this request please?

    #83577

    Hello,

    Go to Angular > Theme Options > Sidebar > then add a unique widget area on a specific page. Once you added a page go to Appearance > Widgets > You will see that there is a new widget area ready to be filled up with widgets.

    Regards,

    Ismael

    #83578

    Thank you Ishamel for your response. I have already done that but the problem is this:

    The widgets that appear on that page are not just the ones that you put in that newly created widget area, it’s also has the widgets from the “sidebar pages” widget area. I want for a page to show the widgets that are in the newly created sidebar only.

    #83579

    Guys,

    I’m finding that there might be an issue with the Avia 2 framework. I can’t seem to get a unique sidebar to work properly on any of the recent themes by Kriesi. If you have widgets that are displayed in the “display pages” area and you create a unique sidebar for a page, any items that you put in your unique sidebar show up in addition to what you have in the “display pages” area.

    Is this the way that it’s supposed to be? Shouldn’t items in the “display pages” widget area not show up on pages that you’ve created a unique sidebar for?

    #83580

    Hi,

    Please try using plugins like Widget Logic or Custom Sidebars for the meantime. I’m still trying to fix the issue.

    Regards,

    Ismael

    #83581

    Hello,

    I hope this fix the sidebar issue. First open includes > admin > register-widget-area.php and find this code

    register_sidebar(array(
    'name' => 'Displayed Everywhere',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '<span class="seperator extralight-border"></span></div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>',
    ));

    Replace it with

    register_sidebar(array(
    'id' => 'display_everywhere',
    'name' => 'Displayed Everywhere',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '<span class="seperator extralight-border"></span></div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>',
    ));

    After that, please remove everything on your sidebar.php and replace it with this code. Once you copy the code, everything on ‘Display Everywhere’ widget area will be reset so you have to supply widgets on that area again. This is the code.

    <?php
    global $avia_config, $custom_widget_area;

    ob_start();
    $default_sidebar = true;

    if(!empty($avia_config['currently_viewing_dynamic_overwrite'])) {$avia_config['currently_viewing'] = $avia_config['currently_viewing_dynamic_overwrite'];}
    if ($avia_config['currently_viewing'] != "fullwidth") // check if its a full width page, if full width dont show the sidebar content
    {
    ##############################################################################
    # Display the sidebar menu
    ##############################################################################

    //check if we should display the left, right or both sidebars
    if(strpos($avia_config['layout'], 'sidebar_left') !== false) $sidebars_to_show = array('left');
    if(strpos($avia_config['layout'], 'sidebar_right') !== false) $sidebars_to_show = array('right');
    if(strpos($avia_config['layout'], 'dual-sidebar') !== false) $sidebars_to_show = array('left','right');

    $subNav = avia_get_option('page_nesting_nav');

    //display the sidebars
    if(!empty($sidebars_to_show) && is_array($sidebars_to_show))
    {
    foreach ($sidebars_to_show as $sidebar)
    {
    $default_sidebar = true;

    echo "<div class='sidebar units sidebar_".$sidebar." ".$avia_config['sidebar_class']."'>";

    echo "<div class='inner_sidebar extralight-border'>";

    /*
    * Display a subnavigation for pages that is automatically generated, so the users doesnt need to work with widgets
    */
    $sidebar_menu = "";

    if($subNav && isset($post) && is_object($post) && !empty($post->ID) && is_page())
    {
    global $post;
    $subNav = false;
    $parent = $post->ID;
    $sidebar_menu = "";

    if (!empty($post->post_parent))
    {
    if(isset($post->ancestors)) $ancestors = $post->ancestors;
    if(!isset($ancestors)) $ancestors = get_post_ancestors($post->ID);
    $root = count($ancestors)-1;
    $parent = $ancestors[$root];
    }

    $children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0");

    if ($children)
    {
    $default_sidebar = false;
    $sidebar_menu .= "<div class='widget widget_nav_menu'><ul class='nested_nav'>";
    $sidebar_menu .= $children;
    $sidebar_menu .= "</ul></div>";
    }
    }

    echo apply_filters('avia_sidebar_menu_filter', $sidebar_menu);

    // single shop sidebars
    if ($avia_config['currently_viewing'] == 'shop_single' && dynamic_sidebar('Single Product Pages') ) : $default_sidebar = false; endif;

    // general shop sidebars
    if ($avia_config['currently_viewing'] == 'shop' && dynamic_sidebar('Shop Overview Page') ) : $default_sidebar = false; endif;

    // general blog sidebars
    if ($avia_config['currently_viewing'] == 'blog' && dynamic_sidebar('Sidebar Blog') ) : $default_sidebar = false; endif;

    // general pages sidebars
    if ($avia_config['currently_viewing'] == 'page' && dynamic_sidebar('Sidebar Pages') ) : $default_sidebar = false; endif;

    // forum pages sidebars
    if ($avia_config['currently_viewing'] == 'forum' && dynamic_sidebar('Forum') ) : $default_sidebar = false; endif;

    function remove_some_sidebars(){
    // Unregsiter some Display Everywhere
    unregister_sidebar( 'display_everywhere' );
    }
    add_action( 'widgets_init', 'remove_some_widgets', 11 );

    $custom_widget_area = avia_check_custom_widget('page');

    //$active_sidebar = dynamic_sidebar('Page: '.$custom_widget_area);

    if (function_exists('dynamic_sidebar') && dynamic_sidebar('Page: '.$custom_widget_area) ) {
    remove_some_sidebars();
    $default_sidebar = false;
    }

    $custom_widget_area = avia_check_custom_widget('cat');

    //unique Category sidebars:
    if (function_exists('dynamic_sidebar') && dynamic_sidebar('Category: '.$custom_widget_area) ) : $default_sidebar = false; endif;

    function register_sidebar_again() {
    register_sidebar(array(
    'id' => 'display_everywhere',
    'name' => 'Displayed Everywhere',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '<span class="seperator extralight-border"></span></div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>',
    ));
    }
    add_action( 'widgets_init', 'register_sidebar_again', 10 );

    //sidebar area displayed everywhere
    if (function_exists('dynamic_sidebar') && $avia_config['currently_viewing'] != 'shop_single' && dynamic_sidebar('Displayed Everywhere')) {
    register_sidebar_again();
    $default_sidebar = false;
    }

    //default dummy sidebar
    if ($default_sidebar)
    {

    avia_dummy_widget(2);
    avia_dummy_widget(3);
    avia_dummy_widget(4);

    }
    echo "</div>";

    echo "</div>";
    }

    }

    }
    $output = ob_get_clean();

    if(($avia_config['currently_viewing'] != "shop_single" && $default_sidebar) || $default_sidebar == false) echo $output;

    wp_reset_query();

    ?>

    Hope it works.

    Regards,

    Ismael

    #83582

    Thanks Ishamel for all of your help. I ended up going with a plugin solution because if I ever update my theme, I’m going to lose all of this code that I would be replacing.

    The plugin that I used was Content Aware Sidebars and it worked great: http://wordpress.org/extend/plugins/content-aware-sidebars/

    Thanks again for all of your help :-)

    Peter

    #83583

    Hey,

    Glad you found a plugin. :)

    Regards,

    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Add new widget areas for sidebar not working properly’ is closed to new replies.