Ejemplo n.º 1
0
 public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     $orderby = strip_tags($instance['orderby']);
     $category = $instance['category'];
     $style = strip_tags($instance['style']);
     $interface = strip_tags($instance['interface']);
     $activeurl = $instance['activeurl'];
     $tooltip = $instance['tooltip'];
     $description = $instance['description'];
     $limit = $instance['limit'];
     $slidersettings = "";
     $img = 0;
     $ids = '0';
     $filter = $instance['filter'];
     $class = $instance['class'];
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo build_lshowcase($orderby, $category, $activeurl, $style, $interface, $tooltip, $description, $limit, $slidersettings, $img, $ids, $filter, $class);
     echo $after_widget;
     if ($filter == 'hide') {
         lshowcase_filter_code();
     }
     if ($filter == 'enhance') {
         lshowcase_enhance_filter_code();
     }
 }
Ejemplo n.º 2
0
function lshowcase_build_filter($display = 'hide', $category = "")
{
    $html = '';
    if ('enhance' == $display) {
        lshowcase_enhance_filter_code();
        $html .= "<ul id='ls-enhance-filter-nav'>";
    }
    if ('hide' == $display) {
        lshowcase_filter_code();
        $html .= "<ul id='ls-filter-nav'>";
    }
    $html .= "<li id='ls-all'>" . __('All', 'lshowcase') . "</li>";
    $includecat = array();
    if ($category != "" && $category != "0") {
        $cats = explode(',', $category);
        foreach ($cats as $cat) {
            $term = get_term_by('slug', $cat, 'lshowcase-categories');
            array_push($includecat, $term->term_id);
        }
        $args = array('include' => $includecat);
    }
    $args['orderby'] = 'slug';
    $args['order'] = 'ASC';
    $args['parent'] = 0;
    $terms = get_terms("lshowcase-categories", $args);
    $count = count($terms);
    if ($count > 0) {
        foreach ($terms as $term) {
            //We check for children
            $childs = '';
            $children_args = array('orderby' => 'slug', 'order' => 'ASC', 'child_of' => $term->term_id);
            $children = get_terms("lshowcase-categories", $children_args);
            $children_count = count($children);
            if ($children_count) {
                $childs .= '<ul>';
                foreach ($children as $cterm) {
                    $childs .= "<li id='ls-" . $cterm->slug . "'>" . $cterm->name . "</li>";
                }
                $childs .= '</ul>';
            }
            $html .= "<li id='ls-" . $term->slug . "'>" . $term->name . $childs . "</li>";
        }
    }
    $html .= "</ul>";
    return $html;
}