Beispiel #1
0
function bb_sidebar($position, $returnWidget = false, $sidebar_wrapper = false)
{
    //global $myVariable;
    //prar($myVariable, false);
    //check position first
    $display = false;
    $pages_widget_right = get_theme_mod('pages_widget_right');
    //prar ( array ('pages_widget_right', $pages_widget_right ) );
    $posts_widget_right = get_theme_mod('posts_widget_right');
    //prar ( array ('posts_widget_right', $pages_widget_right ) );
    //if home page
    if (is_front_page() && get_theme_mod('home_sidebar')) {
        if ($pages_widget_right && $position == 'right') {
            //prar('home left sidebar', false);
            $display = true;
        } elseif (!$pages_widget_right && $position == 'left') {
            //prar('home right sidebar', false);
            $display = true;
        }
        //if blog
        //} elseif ( is_home() ){
        //if is_page
    } elseif (is_page() && !is_front_page()) {
        //prar(get_theme_mod('pages_widget'));
        if (!get_theme_mod('pages_widget')) {
        } elseif ($pages_widget_right && $position == 'right') {
            //prar('pages sidebar right', false);
            $display = true;
        } elseif (!$pages_widget_right && $position == 'left') {
            //prar('left sidebar pages', false);
            $display = true;
        }
        //if is_post
        //if custom post type use is_singular( 'custom-post-type' )
        //else
    } elseif (!is_front_page() && get_theme_mod('posts_widget')) {
        if ($posts_widget_right && $position == 'right') {
            //prar('left sidebar posts', false);
            $display = true;
        } elseif (!$posts_widget_right && $position == 'left') {
            //prar('right sidebar posts', false);
            $display = true;
        }
    }
    if ($display) {
        $sidebarWidget = bb_get_sidebar_widget();
        if ($returnWidget) {
            return $sidebarWidget;
        } else {
            if ($sidebar_wrapper) {
                echo '<aside id="sidebar" role="complementary" class="sidebar">';
            }
            bb_display_widget($sidebarWidget);
            if ($sidebar_wrapper) {
                echo '</aside>';
            }
        }
    }
}
Beispiel #2
0
<?php

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
?>
<!-- tpl- Sidebar -->
<div class="sidebar-wrapper">
<aside id="sidebar" role="complementary" class="sidebar"  tabindex="0">
	<?php 
bb_display_widget(bb_get_sidebar_widget());
?>
</aside>
</div>