コード例 #1
0
function _cb_meta()
{
    $cb_ctp = cb_get_custom_post_types();
    $cb_go = array('id' => 'cb_go', 'title' => 'Ness Post Options', 'desc' => '', 'pages' => $cb_ctp, 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => 'cb_featured_image_style_override', 'label' => 'Override Global Featured Image Style', 'desc' => 'Enable this to override "Theme Options -> Posts -> Global Featured Image Style Override" option.', 'std' => '', 'type' => 'select', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'class' => '', 'choices' => array(array('value' => 'off', 'label' => '-', 'src' => ''), array('value' => 'on', 'label' => 'Override', 'src' => ''))), array('id' => 'cb_featured_image_style', 'label' => 'Featured Image Style', 'desc' => '', 'std' => 'full-background', 'type' => 'radio-image', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'class' => '', 'choices' => array(array('value' => 'full-background', 'label' => 'Full-Background', 'src' => '/img_fs.png'), array('value' => 'parallax', 'label' => 'Parallax', 'src' => '/img_pa.png'), array('value' => 'background-slideshow', 'label' => 'Background Slideshow', 'src' => '/img_bs.png'), array('value' => 'off', 'label' => 'Off', 'src' => '/img_off.png'))), array('id' => 'cb_post_background_slideshow', 'label' => 'Background Slideshow Images', 'desc' => 'Upload/set images to show as a Slideshow', 'std' => '', 'type' => 'gallery', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'condition' => 'cb_featured_image_style:is(background-slideshow)', 'operator' => 'and')));
    ot_register_meta_box($cb_go);
    $cb_go_pages = array('id' => 'cb_go', 'title' => 'Ness Page Options', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => 'cb_featured_image_style', 'label' => 'Featured Image Style', 'desc' => '', 'std' => 'full-background', 'type' => 'radio-image', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'class' => '', 'choices' => array(array('value' => 'full-background', 'label' => 'Full-Background', 'src' => '/img_fs.png'), array('value' => 'parallax', 'label' => 'Parallax', 'src' => '/img_pa.png'), array('value' => 'background-slideshow', 'label' => 'Background Slideshow', 'src' => '/img_bs.png'), array('value' => 'off', 'label' => 'Off', 'src' => '/img_off.png'))), array('id' => 'cb_post_background_slideshow', 'label' => 'Background Slideshow Images', 'desc' => 'Upload/set images to show as a Slideshow', 'std' => '', 'type' => 'gallery', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'condition' => 'cb_featured_image_style:is(background-slideshow)', 'operator' => 'and'), array('id' => 'cb_page_comments', 'label' => 'Page Comments', 'desc' => 'If you enable comments, you may also need to click on "screen options" on the top right and check the "discussion" box and make sure "Allow Comments" is also enabled.', 'std' => 'off', 'type' => 'on-off', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'condition' => '', 'operator' => 'and')));
    ot_register_meta_box($cb_go_pages);
}
コード例 #2
0
ファイル: cat-style-b.php プロジェクト: sovanda/Valenti
<?php

/* Category/Blog Style B */
$i = 0;
if (is_home() || is_category()) {
    $cb_current_cat = get_query_var('cat');
    $cb_cpt_output = cb_get_custom_post_types();
    $cb_paged = get_query_var('paged');
    $cb_grid_size = NULL;
    if ($cb_paged == false) {
        $cb_paged = 1;
    }
    if (is_category() == true) {
        $cb_grid_size = cb_get_category_offset();
    } elseif (is_home() == true) {
        $cb_grid_size = cb_get_bloghome_offset();
    }
    if ($cb_grid_size != NULL) {
        $cb_offset_loop = 'on';
    } else {
        $cb_offset_loop = NULL;
    }
    $cb_featured_qry = array('post_type' => $cb_cpt_output, 'cat' => $cb_current_cat, 'offset' => $cb_grid_size, 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish', 'cb_offset_loop' => $cb_offset_loop, 'paged' => $cb_paged);
    $cb_qry = new WP_Query($cb_featured_qry);
} else {
    global $wp_query;
    $cb_qry = $wp_query;
}
if (!isset($cb_category_color_style)) {
    $cb_category_color_style = NULL;
}
コード例 #3
0
ファイル: core.php プロジェクト: TechDevMX/BlogJivamukti
 function cb_clean_search($cb_query)
 {
     if (is_admin() == false && $cb_query->is_search == true) {
         $cb_cpt_output = cb_get_custom_post_types();
         $cb_query->set('post_type', $cb_cpt_output);
     }
     return $cb_query;
 }
コード例 #4
0
        function widget($args, $instance)
        {
            $cache = wp_cache_get('widget_recent_posts', 'widget');
            if (!is_array($cache)) {
                $cache = array();
            }
            if (!isset($args['widget_id'])) {
                $args['widget_id'] = $this->id;
            }
            if (isset($cache[$args['widget_id']])) {
                echo $cache[$args['widget_id']];
                return;
            }
            ob_start();
            extract($args);
            $cb_title = empty($instance['title']) ? '' : $instance['title'];
            $cb_category = empty($instance['category']) ? '' : $instance['category'];
            $cb_type = empty($instance['type']) ? 'cb-small' : $instance['type'];
            if (empty($instance['number']) || !($cb_number = absint($instance['number']))) {
                $cb_number = 5;
            }
            if ($cb_category != 'cb-all') {
                $cb_cat_qry = $cb_category;
            } else {
                $cb_cat_qry = NULL;
            }
            $cb_cpt_output = cb_get_custom_post_types();
            $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $cb_number, 'no_found_rows' => true, 'category_name' => $cb_cat_qry, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
            if ($cb_qry->have_posts()) {
                echo $before_widget;
                if ($cb_title) {
                    echo $before_title . esc_html($cb_title) . $after_title;
                }
                ?>

    		<div class="cb-module-block cb-small-margin">
    		<?php 
                while ($cb_qry->have_posts()) {
                    $cb_qry->the_post();
                    global $post;
                    $cb_post_id = $post->ID;
                    $cb_width = '100';
                    $cb_height = '65';
                    $cb_style = ' cb-separated';
                    $cb_bg_color = cb_get_img_bg_color($cb_post_id);
                    if ($cb_type == 'cb-article-big') {
                        $cb_width = '360';
                        $cb_height = '240';
                        $cb_style = ' cb-meta-style-2';
                        $cb_bg_color = NULL;
                    }
                    ?>
                <article <?php 
                    post_class('cb-looper cb-article ' . esc_attr($cb_type) . ' ' . esc_attr($cb_style) . ' clearfix', $cb_post_id);
                    ?>
>
                    <div class="cb-mask cb-img-fw" <?php 
                    $cb_bg_color;
                    ?>
>
                        <?php 
                    cb_thumbnail($cb_width, $cb_height);
                    ?>
                        <?php 
                    cb_review_ext_box($cb_post_id, true);
                    ?>
                    </div>
                    <div class="cb-meta cb-article-meta">
                        <h4 class="cb-post-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h4>
                        <?php 
                    echo cb_get_byline_date($cb_post_id);
                    ?>
                    </div>
                    <?php 
                    if ($cb_type == 'cb-article-big') {
                        echo '<a href="' . get_the_permalink() . '" class="cb-link"></a>';
                    }
                    ?>
                </article>
    		<?php 
                }
                ?>
    		</div>
    		<?php 
                echo $after_widget;
                ?>
    <?php 
                wp_reset_postdata();
            }
            $cache[$args['widget_id']] = ob_get_flush();
            wp_cache_set('widget_recent_posts', $cache, 'widget');
        }
コード例 #5
0
        function widget($args, $instance)
        {
            $cache = wp_cache_get('widget_top_reviews', 'widget');
            if (!is_array($cache)) {
                $cache = array();
            }
            if (!isset($args['widget_id'])) {
                $args['widget_id'] = $this->id;
            }
            if (isset($cache[$args['widget_id']])) {
                echo $cache[$args['widget_id']];
                return;
            }
            ob_start();
            extract($args);
            $cb_title = empty($instance['title']) ? '' : $instance['title'];
            $cb_category = empty($instance['category']) ? '' : $instance['category'];
            $cb_filter = empty($instance['filter']) ? '' : $instance['filter'];
            $cb_sortby = empty($instance['sortby']) ? '' : $instance['sortby'];
            $cb_size = empty($instance['cb_size']) ? 'cb-article-small' : $instance['cb_size'];
            $cb_type = empty($instance['type']) ? '' : $instance['type'];
            $cb_cpt_output = cb_get_custom_post_types();
            if ($cb_filter == NULL) {
                $cb_filter = 'alltime';
            }
            if (empty($instance['number']) || !($number = absint($instance['number']))) {
                $number = 5;
            }
            if ($cb_category != 'cb-all') {
                $cb_cat_qry = $cb_category;
            } else {
                $cb_cat_qry = NULL;
            }
            if ($cb_type == 'cb-reader-score') {
                $cb_type_filter = 'cb_user_score_output';
            } else {
                $cb_type_filter = 'cb_final_score';
            }
            if ($cb_sortby == 'topscores') {
                $cb_sortby_orderby = 'meta_value_num';
                $cb_sortby_order = 'DESC';
            } elseif ($cb_sortby == 'latestscores') {
                $cb_sortby_order = 'DESC';
                $cb_sortby_orderby = 'date';
            } elseif ($cb_sortby == 'lowestscores') {
                $cb_sortby_orderby = 'meta_value_num';
                $cb_sortby_order = 'ASC';
            }
            if ($cb_filter == 'week') {
                $cb_week = date('W');
                $cb_year = date('Y');
                $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'year' => $cb_year, 'w' => $cb_week, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => $cb_sortby_orderby, 'order' => $cb_sortby_order, 'ignore_sticky_posts' => true));
            } elseif ($cb_filter == 'alltime') {
                $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => $cb_sortby_orderby, 'order' => $cb_sortby_order, 'ignore_sticky_posts' => true));
            } elseif ($cb_filter == 'month') {
                $cb_month = date('m', strtotime('-30 days'));
                $cb_year = date('Y', strtotime('-30 days'));
                $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'year' => $cb_year, 'monthnum' => $cb_month, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => $cb_sortby_order, 'order' => $cb_sortby_orderby, 'ignore_sticky_posts' => true));
            } elseif ($cb_filter == '2011' || $cb_filter == '2012' || $cb_filter == '2013' || $cb_filter == '2014' || $cb_filter == '2015') {
                $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'year' => $cb_filter, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => $cb_sortby_orderby, 'order' => $cb_sortby_order, 'ignore_sticky_posts' => true));
            }
            if ($cb_qry->have_posts()) {
                echo $before_widget;
                if ($cb_title != NULL) {
                    echo $before_title . esc_html($cb_title) . $after_title;
                }
                echo '<div class="cb-module-block">';
                $i = 1;
                while ($cb_qry->have_posts()) {
                    $cb_qry->the_post();
                    global $post;
                    $cb_post_id = $post->ID;
                    $cb_review_checkbox = get_post_meta($cb_post_id, 'cb_review_checkbox', true);
                    if ($cb_review_checkbox != 'on') {
                        continue;
                    }
                    if ($cb_size == 'cb-article-small') {
                        $cb_width = '100';
                        $cb_height = '65';
                        $cb_style = ' cb-separated';
                        $cb_small_box = true;
                    }
                    if ($cb_size == 'cb-article-big') {
                        $cb_width = '360';
                        $cb_height = '240';
                        $cb_small_box = false;
                        $cb_style = ' cb-meta-style-r';
                    }
                    ?>
                    <article class="cb-article <?php 
                    echo esc_attr($cb_size) . ' ' . esc_attr($cb_style);
                    ?>
 clearfix">

                        <div class="cb-meta">
                            <h4 class="cb-post-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h4>
                            <?php 
                    cb_review_byline($cb_post_id);
                    ?>
                        
                        </div>
                        <?php 
                    if ($cb_type == 'cb-article-big') {
                        echo '<a href="' . get_the_permalink() . '" class="cb-link"></a>';
                    }
                    ?>
                    </article>
<?php 
                    $i++;
                }
                echo '</div>';
                echo $after_widget;
                wp_reset_postdata();
            }
            $cache[$args['widget_id']] = ob_get_flush();
            wp_cache_set('widget_top_reviews', $cache, 'widget');
        }
        function widget($args, $instance)
        {
            $cache = wp_cache_get('widget_recent_posts_slider', 'widget');
            if (!is_array($cache)) {
                $cache = array();
            }
            if (!isset($args['widget_id'])) {
                $args['widget_id'] = $this->id;
            }
            if (isset($cache[$args['widget_id']])) {
                echo $cache[$args['widget_id']];
                return;
            }
            ob_start();
            extract($args);
            $cb_title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
            $cb_category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base);
            if (empty($instance['number']) || !($cb_number = absint($instance['number']))) {
                $cb_number = 6;
            }
            if ($cb_category != 'cb-all') {
                $cb_cat_qry = $cb_category;
            } else {
                $cb_cat_qry = NULL;
            }
            $cb_cpt_output = cb_get_custom_post_types();
            $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $cb_number, 'no_found_rows' => true, 'category_name' => $cb_cat_qry, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
            if ($cb_qry->have_posts()) {
                echo $before_widget;
                if ($cb_title) {
                    echo $before_title . esc_html($cb_title) . $after_title;
                }
                ?>
    		<div class="cb-slider cb-slider-1 cb-recent-slider cb-relative cb-arrows-tr clearfix">
        		<ul class="slides">

        		<?php 
                while ($cb_qry->have_posts()) {
                    $cb_qry->the_post();
                    global $post;
                    $cb_post_id = $post->ID;
                    ?>
                    <li <?php 
                    post_class('cb-article cb-style-1 clearfix');
                    ?>
>

                        <div class="cb-mask"><?php 
                    cb_thumbnail('360', '240', $cb_post_id);
                    ?>
</div>

                        <div class="cb-meta">
                            <h4 class="cb-post-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h4>
                            <?php 
                    echo cb_get_byline_date($cb_post_id);
                    ?>
                        </div>

                    </li>
        		<?php 
                }
                ?>
        		</ul>
    		</div>

    		<?php 
                echo $after_widget;
                wp_reset_postdata();
            }
            $cache[$args['widget_id']] = ob_get_flush();
            wp_cache_set('widget_recent_posts_slider', $cache, 'widget');
        }
コード例 #7
0
ファイル: core.php プロジェクト: sovanda/Valenti
 function start_el(&$output, $object, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $classes = empty($object->classes) ? array() : (array) $object->classes;
     $classes[] = 'menu-item-' . $object->ID;
     /**
      * Filter the CSS class(es) applied to a menu item's <li>.
      *
      * @since 3.0.0
      *
      * @see wp_nav_menu()
      *
      * @param array  $classes The CSS classes that are applied to the menu item's <li>.
      * @param object $item    The current menu item.
      * @param array  $args    An array of wp_nav_menu() arguments.
      */
     $class_names = join(' ', (array) apply_filters('nav_menu_css_class', array_filter($classes), $object, $args));
     $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
     /**
      * Filter the ID applied to a menu item's <li>.
      *
      * @since 3.0.1
      *
      * @see wp_nav_menu()
      *
      * @param string $menu_id The ID that is applied to the menu item's <li>.
      * @param object $object    The current menu item.
      * @param array  $args    An array of wp_nav_menu() arguments.
      */
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $object->ID, $object, $args);
     $id = $id ? ' id="' . esc_attr($id) . '"' : '';
     $output .= $indent . '<li' . $id . $class_names . '>';
     $atts = array();
     $atts['title'] = !empty($object->attr_title) ? $object->attr_title : '';
     $atts['target'] = !empty($object->target) ? $object->target : '';
     $atts['rel'] = !empty($object->xfn) ? $object->xfn : '';
     $atts['href'] = !empty($object->url) ? $object->url : '';
     /**
      * Filter the HTML attributes applied to a menu item's <a>.
      *
      * @since 3.6.0
      *
      * @see wp_nav_menu()
      *
      * @param array $atts {
      *     The HTML attributes applied to the menu item's <a>, empty strings are ignored.
      *
      *     @type string $title  Title attribute.
      *     @type string $target Target attribute.
      *     @type string $rel    The rel attribute.
      *     @type string $href   The href attribute.
      * }
      * @param object $item The current menu item.
      * @param array  $args An array of wp_nav_menu() arguments.
      */
     $atts = apply_filters('nav_menu_link_attributes', $atts, $object, $args);
     $attributes = '';
     foreach ($atts as $attr => $value) {
         if (!empty($value)) {
             $value = 'href' === $attr ? esc_url($value) : esc_attr($value);
             $attributes .= ' ' . $attr . '="' . $value . '"';
         }
     }
     $cb_cat_menu = $object->cbmegamenu;
     if ($depth > 0) {
         $cb_ajax_onoff = ot_get_option('cb_ajax_mm', 'on');
         if ($cb_ajax_onoff == 'on') {
             $attributes .= ' data-cb-c="' . $object->object_id . '" class="cb-c-l"';
         }
     }
     if ($cb_cat_menu == NULL) {
         $cb_cat_menu = '2';
     }
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . apply_filters('the_title', $object->title, $object->ID) . $args->link_after;
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $object, $depth, $args);
     $cb_base_color = ot_get_option('cb_base_color', '#eb9812');
     if (function_exists('get_tax_meta')) {
         $cb_color = get_tax_meta($object->object_id, 'cb_color_field_id');
     } else {
         $cb_color = $cb_base_color;
     }
     $cb_output = $cb_posts = $cb_menu_featured = $cb_has_children = $cb_slider_output = NULL;
     $cb_current_type = $object->object;
     $cb_current_classes = $object->classes;
     if (in_array('cb-has-children', $cb_current_classes)) {
         $cb_has_children = ' cb-with-sub cb-pre-load';
     }
     if (($cb_cat_menu == 1 || $cb_cat_menu == 4) && $object->menu_item_parent == '0') {
         $output .= '<div class="cb-big-menu">';
     }
     if ($cb_cat_menu == 2 && $depth == 0 && $object->menu_item_parent == '0' && in_array('cb-has-children', $cb_current_classes)) {
         $output .= '<div class="cb-links-menu">';
     }
     if ($cb_cat_menu == 3 && $object->menu_item_parent == '0') {
         $output .= '<div class="cb-mega-menu">';
     }
     if ($cb_cat_menu == 1 && $object->menu_item_parent == '0') {
         $cb_cat_id = $object->object_id;
         if (function_exists('get_tax_meta')) {
             $cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
         } else {
             $cb_category_color = NULL;
         }
         if ($cb_category_color == NULL || $cb_category_color == '#') {
             $cb_category_color = $cb_base_color;
         }
         $cb_cpt_output = cb_get_custom_post_types();
         $cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'meta_key' => 'cb_featured_post_menu', 'meta_value' => 'featured', 'meta_compare' => '==');
         $cb_qry_featured = $cb_img = NULL;
         $cb_qry_featured = new WP_Query($cb_args_featured);
         $cb_featured_random_title = __('Featured', 'cubell');
         if ($cb_qry_featured->post_count == 0) {
             $cb_qry_featured = NULL;
             $cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
             $cb_qry_featured = new WP_Query($cb_args_featured);
             $cb_featured_random_title = __('Random', 'cubell');
         }
         foreach ($cb_qry_featured->posts as $cb_post) {
             setup_postdata($cb_post);
             $cb_post_id = $cb_post->ID;
             $cb_img = cb_get_thumbnail('480', '240', $cb_post_id);
             $cb_permalink = get_permalink($cb_post_id);
             $cb_menu_featured .= ' <li class="cb-article clearfix">
                 <div class="cb-mask" style="background-color:' . $cb_category_color . ';">' . $cb_img . cb_review_ext_box($cb_post_id, $cb_category_color) . '</div>
                 <div class="cb-meta">
                     <h2 class="h4"><a href="' . esc_url($cb_permalink) . '">' . $cb_post->post_title . '</a></h2>
                     ' . cb_byline(true, $cb_post_id) . '
                 </div></li>';
         }
         wp_reset_postdata();
         if ($cb_has_children == NULL) {
             $cb_qry_amount = 6;
             $cb_big_recent = ' cb-recent-fw';
             $cb_closer = '</div>';
         } else {
             $cb_qry_amount = 3;
             $cb_big_recent = $cb_closer = NULL;
         }
         $cb_cpt_output = cb_get_custom_post_types();
         $cb_args = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => $cb_qry_amount, 'ignore_sticky_posts' => 1, 'post__not_in' => array($cb_post_id));
         $cb_qry_latest = $cb_img = NULL;
         $cb_qry_latest = new WP_Query($cb_args);
         $i = 1;
         while ($cb_qry_latest->have_posts()) {
             $cb_qry_latest->the_post();
             $cb_post_id = get_the_ID();
             $cb_post_title = get_the_title();
             $cb_img = cb_get_thumbnail('80', '60', $cb_post_id);
             $cb_permalink = get_permalink($cb_post_id);
             $cb_posts .= ' <li class="cb-article-' . $i . ' clearfix">
                 <div class="cb-mask" style="background-color:' . $cb_category_color . ';">' . $cb_img . cb_review_ext_box($cb_post_id, $cb_category_color, true) . '</div>
                 <div class="cb-meta">
                     <h2 class="h4"><a href="' . esc_url($cb_permalink) . '">' . $cb_post_title . '</a></h2>
                     ' . cb_byline(false, $cb_post_id, true) . '
                 </div></li>';
             $i++;
         }
         wp_reset_postdata();
     }
     if ($cb_cat_menu == 4 && $object->menu_item_parent == '0') {
         $cb_cpt_output = cb_get_custom_post_types();
         $cb_cat_id = $object->object_id;
         if (function_exists('get_tax_meta')) {
             $cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
         } else {
             $cb_category_color = NULL;
         }
         if ($cb_has_children != NULL) {
             $cb_slider_type = 'flexslider-1-menu';
             $cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => 9, 'ignore_sticky_posts' => 1);
         } else {
             $cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => 12, 'ignore_sticky_posts' => 1);
             $cb_slider_type = 'flexslider-1-fw-menu';
         }
         $cb_qry_featured = $cb_img = NULL;
         $cb_qry_featured = new WP_Query($cb_args_featured);
         $cb_featured_random_title = __('Recent', 'cubell');
         foreach ($cb_qry_featured->posts as $cb_post) {
             setup_postdata($cb_post);
             $cb_post_id = $cb_post->ID;
             $cb_category_color = cb_get_cat_color($cb_post_id);
             if (has_post_thumbnail($cb_post_id)) {
                 $cb_img = get_the_post_thumbnail($cb_post_id, 'cb-750-400');
             }
             $cb_permalink = get_permalink($cb_post_id);
             $cb_slider_output .= ' <li>
                 <div class="cb-mask" style="border-top-color:' . $cb_category_color . ';"><a href="' . esc_url($cb_permalink) . '">' . $cb_img . '</a>' . cb_review_ext_box($cb_post_id, $cb_category_color) . '</div>
                 <div class="cb-meta">
                     <h2><a href="' . esc_url($cb_permalink) . '">' . $cb_post->post_title . '</a></h2>
                     ' . cb_byline(true, $cb_post_id) . '
                 </div>' . cb_review_ext_box($cb_post_id, $cb_category_color) . '</li>';
         }
         wp_reset_postdata();
     }
     if ($cb_current_type == 'category') {
         if ($cb_color == '#' || $cb_color == NULL) {
             $cb_color = $cb_base_color;
         }
         $this->cb_menu_css[] .= '#cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ':hover,
                                      #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ':focus,
                                      #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ' .cb-sub-menu li .cb-grandchild-menu,
                                      #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ' .cb-sub-menu { background:' . $cb_color . '!important; }
                                      #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ' .cb-mega-menu .cb-sub-menu li a { border-bottom-color:' . $cb_color . '!important; }';
         $cb_border_color = $cb_color;
     } else {
         $cb_page_color = get_post_meta($object->object_id, 'cb_overall_color_post');
         if ($cb_page_color != NULL && $cb_page_color[0] != '#') {
             $cb_base_color = $cb_page_color[0];
         }
         $this->cb_menu_css[] .= '#cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ':hover,
                                  #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ':focus,
                                  #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ' .cb-sub-menu li .cb-grandchild-menu,
                                  #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ' .cb-sub-menu { background:' . $cb_base_color . '!important; }
                                  #cb-nav-bar #cb-main-menu .main-nav .menu-item-' . $object->ID . ' .cb-mega-menu .cb-sub-menu li a { border-bottom-color:' . $cb_base_color . '!important; }';
         $cb_border_color = $cb_base_color;
     }
     if ($cb_posts != NULL) {
         $output .= '<div class="cb-articles' . $cb_has_children . '">
                             <div class="cb-featured">
                                 <div class="cb-mega-title h2"><span style="border-bottom-color:' . $cb_border_color . ';">' . $cb_featured_random_title . '</span></div>
                                 <ul>' . $cb_menu_featured . '</ul>
                              </div>
                              <div class="cb-recent' . $cb_big_recent . '">
                                 <div class="cb-mega-title h2"><span style="border-bottom-color:' . $cb_border_color . ';">' . __('Recent', 'cubell') . '</span></div>
                                 <ul>' . $cb_posts . '</ul>
                              </div>
                          </div>';
         $output .= $cb_closer;
     }
     if ($cb_slider_output != NULL) {
         $output .= '<div class="cb-articles' . $cb_has_children . '">
                             <h2 class="cb-mega-title cb-slider-title"><span style="border-bottom-color:' . $cb_border_color . ';">' . $cb_featured_random_title . '</span></h2>
                             <div class="cb-slider-a">
                                 <div class="' . $cb_slider_type . ' clearfix">
                                     <ul class="slides">' . $cb_slider_output . '</ul>
                                     </div>
                                 </div>
                             </div>';
     }
     add_action('wp_head', array($this, 'cb_menu_css'));
 }
コード例 #8
0
 function start_el(&$output, $object, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $classes = empty($object->classes) ? array() : (array) $object->classes;
     $classes[] = 'menu-item-' . $object->ID;
     /**
      * Filter the CSS class(es) applied to a menu item's <li>.
      *
      * @since 3.0.0
      *
      * @see wp_nav_menu()
      *
      * @param array  $classes The CSS classes that are applied to the menu item's <li>.
      * @param object $item    The current menu item.
      * @param array  $args    An array of wp_nav_menu() arguments.
      */
     $class_names = join(' ', (array) apply_filters('nav_menu_css_class', array_filter($classes), $object, $args));
     $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
     /**
      * Filter the ID applied to a menu item's <li>.
      *
      * @since 3.0.1
      *
      * @see wp_nav_menu()
      *
      * @param string $menu_id The ID that is applied to the menu item's <li>.
      * @param object $object    The current menu item.
      * @param array  $args    An array of wp_nav_menu() arguments.
      */
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $object->ID, $object, $args);
     $id = $id ? ' id="' . esc_attr($id) . '"' : '';
     $output .= $indent . '<li' . $id . $class_names . '>';
     $atts = array();
     $atts['title'] = !empty($object->attr_title) ? $object->attr_title : '';
     $atts['target'] = !empty($object->target) ? $object->target : '';
     $atts['rel'] = !empty($object->xfn) ? $object->xfn : '';
     $atts['href'] = !empty($object->url) ? $object->url : '';
     /**
      * Filter the HTML attributes applied to a menu item's <a>.
      *
      * @since 3.6.0
      *
      * @see wp_nav_menu()
      *
      * @param array $atts {
      *     The HTML attributes applied to the menu item's <a>, empty strings are ignored.
      *
      *     @type string $title  Title attribute.
      *     @type string $target Target attribute.
      *     @type string $rel    The rel attribute.
      *     @type string $href   The href attribute.
      * }
      * @param object $item The current menu item.
      * @param array  $args An array of wp_nav_menu() arguments.
      */
     $atts = apply_filters('nav_menu_link_attributes', $atts, $object, $args);
     $attributes = '';
     foreach ($atts as $attr => $value) {
         if (!empty($value)) {
             $value = 'href' === $attr ? esc_url($value) : esc_attr($value);
             $attributes .= ' ' . $attr . '="' . $value . '"';
         }
     }
     $cb_cat_menu = $object->cbmegamenu;
     if ($depth > 0) {
         if (ot_get_option('cb_ajax_mm', 'on') == 'on') {
             $attributes .= ' data-cb-c="' . $object->object_id . '" class="cb-c-l"';
         }
     }
     if ($cb_cat_menu == NULL) {
         $cb_cat_menu = '2';
     }
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . apply_filters('the_title', $object->title, $object->ID) . $args->link_after;
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $object, $depth, $args);
     $cb_base_color = ot_get_option('cb_base_color', '#f2c231');
     if (function_exists('get_tax_meta')) {
         $cb_use_color = get_tax_meta($object->object_id, 'cb_color_field_id');
     } else {
         $cb_use_color = $cb_base_color;
     }
     $cb_output = $cb_featured_plus_four = $cb_posts = $cb_menu_featured = $cb_slider_output = $cb_has_children = NULL;
     $cb_current_type = $object->object;
     $cb_current_classes = $object->classes;
     if (in_array('cb-has-children', $cb_current_classes)) {
         $cb_has_children = ' cb-with-sub';
     }
     if (($cb_cat_menu == 3 || $cb_cat_menu == 4) && $object->menu_item_parent == '0') {
         $output .= '<div class="cb-menu-drop cb-bg cb-mega-menu cb-big-menu clearfix">';
     }
     if ($cb_cat_menu == 1 && $depth == 0 && $object->menu_item_parent == '0' && in_array('cb-has-children', $cb_current_classes)) {
         $output .= '<div class="cb-links-menu cb-menu-drop">';
     }
     if ($cb_cat_menu == 2 && $object->menu_item_parent == '0') {
         $output .= '<div class="cb-menu-drop cb-bg cb-mega-menu cb-mega-menu-columns">';
     }
     if ($cb_cat_menu == 3 && $object->menu_item_parent == '0') {
         $cb_cat_id = $object->object_id;
         $cb_category_color = NULL;
         $cb_posts .= '<div class="cb-upper-title"><h2>' . $object->title . '</h2><a href="' . $object->url . '" class="cb-see-all">' . __('See all', 'cubell') . '</a></div><ul class="cb-sub-posts">';
         if (function_exists('get_tax_meta')) {
             $cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
         }
         if ($cb_category_color == NULL || $cb_category_color == '#') {
             $cb_category_color = $cb_base_color;
         }
         $cb_cpt_output = cb_get_custom_post_types();
         if ($cb_has_children == NULL) {
             $cb_mega_classes = 'cb-mega-three cb-mega-posts ';
             $cb_width = '360';
             $cb_height = '240';
             $cb_closer = '</div>';
             $cb_ppp = apply_filters('cb-mm-number-posts', '3');
         } else {
             $cb_mega_classes = 'cb-sub-mega-three cb-pre-load cb-mega-posts ';
             $cb_width = '260';
             $cb_height = '170';
             $cb_closer = NULL;
             $cb_ppp = apply_filters('cb-mm-with-menu-number-posts', '3');
         }
         $cb_args = array('cat' => $cb_cat_id, 'post_status' => 'publish', 'posts_per_page' => $cb_ppp, 'ignore_sticky_posts' => 1);
         $cb_qry_latest = new WP_Query($cb_args);
         $i = 1;
         $cb_post_output = NULL;
         while ($cb_qry_latest->have_posts()) {
             $cb_qry_latest->the_post();
             $cb_post_id = get_the_ID();
             $cb_posts .= ' <li class="' . implode(" ", get_post_class("cb-looper cb-article-" . $i . " cb-mm-posts-count-" . $cb_ppp . " cb-style-1 clearfix", $cb_post_id)) . '"><div class="cb-mask cb-img-fw" ' . cb_get_img_bg_color($cb_post_id) . '>' . cb_get_thumbnail($cb_width, $cb_height, $cb_post_id) . '</div><div class="cb-meta"><h2 class="cb-post-title"><a href="' . esc_url(get_permalink($cb_post_id)) . '">' . get_the_title() . '</a></h2>' . cb_get_byline_date($cb_post_id) . '</div></li>';
             $i++;
         }
         wp_reset_postdata();
         $cb_posts .= '</ul>';
     }
     if ($object->menu_item_parent == '0') {
         if ($cb_current_type == 'category') {
             if ($cb_use_color != NULL) {
                 $this->cb_menu_css[] .= '.cb-mm-on #cb-nav-bar .cb-main-nav .menu-item-' . $object->ID . ':hover, .cb-mm-on #cb-nav-bar .cb-main-nav .menu-item-' . $object->ID . ':focus { background:' . $cb_use_color . ' !important ; }';
                 $this->cb_menu_css[] .= '.cb-mm-on #cb-nav-bar .cb-main-nav .menu-item-' . $object->ID . ' .cb-big-menu { border-top-color: ' . $cb_use_color . '; }';
             }
         } else {
             $cb_page_color = get_post_meta($object->object_id, 'cb_overall_color_post');
             if ($cb_page_color != NULL && $cb_page_color[0] != '#') {
                 $this->cb_menu_css[] .= '.cb-mm-on #cb-nav-bar .cb-main-nav .menu-item-' . $object->ID . ':hover, .cb-mm-on #cb-nav-bar .cb-main-nav .menu-item-' . $object->ID . ':focus { background:' . $cb_page_color[0] . ' !important  ; }';
             }
         }
     }
     if ($cb_posts != NULL) {
         $output .= '<div class="' . $cb_mega_classes . ' clearfix">' . $cb_posts . '</div>' . $cb_closer;
     }
     add_action('wp_head', array($this, 'cb_menu_css'));
 }
コード例 #9
0
 function cb_register_sidebars()
 {
     $cb_footer_layout = ot_get_option('cb_footer_layout', 'cb-footer-a');
     // Main Sidebar
     register_sidebar(array('name' => 'Global Sidebar', 'id' => 'sidebar-global', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     // Footer Widget 1
     register_sidebar(array('name' => 'Footer 1', 'id' => 'footer-1', 'before_widget' => '<div id="%1$s" class="cb-footer-widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-footer-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     if ($cb_footer_layout != 'cb-footer-e') {
         // Footer Widget 2
         register_sidebar(array('name' => 'Footer 2', 'id' => 'footer-2', 'before_widget' => '<div id="%1$s" class="cb-footer-widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-footer-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     }
     if ($cb_footer_layout != 'cb-footer-e' && $cb_footer_layout != 'cb-footer-f') {
         // Footer Widget 3
         register_sidebar(array('name' => 'Footer 3', 'id' => 'footer-3', 'before_widget' => '<div id="%1$s" class="cb-footer-widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-footer-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     }
     if ($cb_footer_layout == 'cb-footer-b') {
         // Footer Widget 4
         register_sidebar(array('name' => 'Footer 4', 'id' => 'footer-4', 'before_widget' => '<div id="%1$s" class="cb-footer-widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-footer-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     }
     register_sidebar(array('name' => '15Zine Multi-Widgets Area', 'id' => 'cb_multi_widgets', 'description' => '1- Drag multiple widgets here 2- Drag the "15Zine Multi-Widget Widget" to the sidebar where you want to show the multi-widgets.', 'before_widget' => '<div id="%1$s" class="widget cb-multi-widget tabbertab %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-widget-title">', 'after_title' => '</h3>'));
     if (class_exists('Woocommerce')) {
         register_sidebar(array('name' => '15Zine WooCommerce Sidebar', 'id' => 'sidebar-woocommerce', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     }
     if (class_exists('bbPress')) {
         register_sidebar(array('name' => '15Zine bbPress Sidebar', 'id' => 'sidebar-bbpress', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     }
     if (function_exists('buddypress')) {
         register_sidebar(array('name' => '15Zine BuddyPress Sidebar', 'id' => 'sidebar-buddypress', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
     }
     $cb_pages = get_pages(array('post_status' => array('publish', 'pending', 'private', 'draft')));
     foreach ($cb_pages as $page) {
         $cb_page_sidebar = get_post_meta($page->ID, 'cb_page_custom_sidebar_type', true);
         $cb_page_template = get_post_meta($page->ID, '_wp_page_template', true);
         if ($cb_page_sidebar == 'cb_unique_sidebar') {
             register_sidebar(array('name' => $page->post_title . ' (Page)', 'id' => 'page-' . $page->ID . '-sidebar', 'description' => 'This is the ' . $page->post_title . ' sidebar', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
         }
         if ($cb_page_template == 'page-15zine-builder.php') {
             // Homepage Section B Sidebar
             register_sidebar(array('name' => 'Section B Sidebar (' . $page->post_title . ' page)', 'id' => 'sidebar-hp-b-' . $page->ID, 'description' => 'Page: ' . $page->post_title, 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
         }
     }
     if (function_exists('get_tax_meta')) {
         $categories = get_categories(array('hide_empty' => 0));
         foreach ($categories as $category) {
             $cat_onoff = get_tax_meta($category->cat_ID, 'cb_cat_sidebar');
             if ($cat_onoff == 'on') {
                 register_sidebar(array('name' => $category->cat_name, 'id' => $category->category_nicename . '-sidebar', 'description' => 'This is the ' . $category->cat_name . ' sidebar', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
             }
         }
     }
     $cb_cpt_output = cb_get_custom_post_types();
     $cb_qry = new WP_Query(array('post_status' => array('publish', 'pending', 'private', 'draft'), 'post_type' => 'post', 'meta_key' => 'cb_post_custom_sidebar_type', 'meta_value' => 'cb_unique_sidebar'));
     if ($cb_qry->have_posts()) {
         while ($cb_qry->have_posts()) {
             $cb_qry->the_post();
             global $post;
             $cb_sidebar_type = get_post_meta($post->ID, 'cb_post_sidebar', true);
             if ($cb_sidebar_type == 'off') {
                 $cb_post_title = get_the_title($post->ID);
                 register_sidebar(array('name' => $cb_post_title . ' (Post)', 'id' => 'post-' . $post->ID . '-sidebar', 'description' => 'This is the ' . $cb_post_title . ' sidebar', 'before_widget' => '<div id="%1$s" class="cb-sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="cb-sidebar-widget-title cb-widget-title">', 'after_title' => '</h3>'));
             }
         }
     }
     wp_reset_postdata();
 }
コード例 #10
0
        function widget($args, $instance)
        {
            $cache = wp_cache_get('widget_popular_posts', 'widget');
            if (!is_array($cache)) {
                $cache = array();
            }
            if (!isset($args['widget_id'])) {
                $args['widget_id'] = $this->id;
            }
            if (isset($cache[$args['widget_id']])) {
                echo $cache[$args['widget_id']];
                return;
            }
            ob_start();
            extract($args);
            $cb_title = empty($instance['cb_title']) ? '' : $instance['cb_title'];
            $cb_category = empty($instance['category']) ? '' : $instance['category'];
            $cb_type = empty($instance['cb_type']) ? 'cb-article-small' : $instance['cb_type'];
            $cb_filter_date = empty($instance['cb_filter_date']) ? 'alltime' : $instance['cb_filter_date'];
            $cb_filter_by = empty($instance['cb_filter_by']) ? 'cb-comments' : $instance['cb_filter_by'];
            if (empty($instance['cb_number']) || !($cb_number = absint($instance['cb_number']))) {
                $cb_number = 5;
            }
            if ($cb_category != 'cb-all') {
                $cb_cat_qry = $cb_category;
            } else {
                $cb_cat_qry = NULL;
            }
            $cb_qry = NULL;
            $cb_c = 300;
            $i = 1;
            if ($cb_filter_by == 'cb-visits') {
                if (function_exists('stats_get_csv')) {
                    if ($cb_filter_date == 'week') {
                        $cb_weekly_qry = 'cb-week-pop';
                        if (($cb_qry = get_transient($cb_weekly_qry)) === false) {
                            $cb_qry = stats_get_csv('postviews', 'days=8&limit=' . (6 + $cb_number));
                            set_transient($cb_weekly_qry, $cb_qry, $cb_c);
                        }
                    } elseif ($cb_filter_date == 'month') {
                        $cb_monthly_qry = 'cb-month-pop';
                        if (($cb_qry = get_transient($cb_monthly_qry)) === false) {
                            $cb_qry = stats_get_csv('postviews', 'days=31&limit=' . (6 + $cb_number));
                            set_transient($cb_monthly_qry, $cb_qry, $cb_c);
                        }
                    } elseif ($cb_filter_date == 'alltime') {
                        $cb_alltime_qry = 'cb-alltime-pop';
                        if (($cb_qry = get_transient($cb_alltime_qry)) === false) {
                            $cb_qry = stats_get_csv('postviews', 'days=-1&limit=' . (6 + $cb_number));
                            set_transient($cb_alltime_qry, $cb_qry, $cb_c);
                        }
                    }
                } else {
                    echo '<div class="cb-sidebar-widget">15Zine Popular Posts Widget: To use the "View Count" option You need to install Jetpack plugin and enable the "Stats" module.</div>';
                }
            } else {
                $cb_cpt_output = cb_get_custom_post_types();
                $cb_qry = new WP_Query(array('post_type' => $cb_cpt_output, 'posts_per_page' => $cb_number, 'category_name' => $cb_cat_qry, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'orderby' => 'comment_count'));
            }
            echo $before_widget;
            $cb_width = '100';
            $cb_height = '65';
            $cb_style = ' cb-separated';
            if ($cb_type == 'cb-article-big') {
                $cb_width = '360';
                $cb_height = '240';
                $cb_style = ' cb-meta-style-2';
            }
            if ($cb_title) {
                echo $before_title . esc_html($cb_title) . $after_title;
            }
            echo '<div class="cb-module-block cb-small-margin">';
            if ($cb_filter_by == 'cb-comments' && $cb_qry->have_posts()) {
                while ($cb_qry->have_posts()) {
                    $cb_qry->the_post();
                    global $post;
                    $cb_post_id = $post->ID;
                    ?>
                    <article <?php 
                    post_class('cb-article ' . esc_attr($cb_type) . ' ' . esc_attr($cb_style) . ' clearfix');
                    ?>
>
                        <div class="cb-mask cb-img-fw" <?php 
                    cb_img_bg_color($cb_post_id);
                    ?>
>
                            <?php 
                    cb_thumbnail($cb_width, $cb_height);
                    ?>
                            <?php 
                    cb_review_ext_box($cb_post_id, true);
                    ?>
                        </div>
                        <div class="cb-meta cb-article-meta">
                            <h4 class="cb-post-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h4>
                            <div class="cb-byline cb-byline-short cb-comment-count">
                                <a href="<?php 
                    echo get_comments_link($cb_post_id);
                    ?>
">
                                    <?php 
                    echo number_format_i18n(get_comments_number($cb_post_id)) . ' ' . __('Comments', 'cubell');
                    ?>
                                </a>
                            </div>
                        </div>
                        <?php 
                    if ($cb_type == 'cb-article-big') {
                        echo '<a href="' . get_the_permalink() . '" class="cb-link"></a>';
                    }
                    ?>
                    </article>

<?php 
                }
                wp_reset_postdata();
            }
            if ($cb_filter_by == 'cb-visits' && !empty($cb_qry)) {
                $cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on');
                $cb_post_meta_views = ot_get_option('cb_byline_postviews', 'on');
                foreach ($cb_qry as $cb_post) {
                    $cb_post_id = $cb_post['post_id'];
                    $cb_cats = wp_get_post_categories($cb_post_id);
                    if (empty($cb_cats)) {
                        continue;
                    }
                    ?>
                    <article class="cb-article <?php 
                    echo esc_attr($cb_type) . ' ' . esc_attr($cb_style);
                    ?>
 clearfix">
                        <div class="cb-mask cb-img-fw">
                            <?php 
                    cb_thumbnail($cb_width, $cb_height, $cb_post_id);
                    ?>
                        </div>
                        <div class="cb-meta cb-article-meta">
                            <h4 class="cb-post-title"><a href="<?php 
                    echo esc_url($cb_post['post_permalink']);
                    ?>
"><?php 
                    echo esc_html($cb_post['post_title']);
                    ?>
</a></h4>
                            <?php 
                    if ($cb_meta_onoff == 'on' && $cb_post_meta_views == 'on') {
                        ?>
                                <div class="cb-byline cb-byline-short cb-comment-count"><?php 
                        echo intval($cb_post['views']);
                        ?>
 <?php 
                        _e('Views', 'cubell');
                        ?>
</div>
                            <?php 
                    }
                    ?>
                       </div>
                       <?php 
                    if ($cb_type == 'cb-article-big') {
                        echo '<a href="' . get_the_permalink() . '" class="cb-link"></a>';
                    }
                    ?>
                    </article>
<?php 
                    if ($i == $cb_number) {
                        break;
                    }
                    $i++;
                }
            }
            echo '</div>';
            echo $after_widget;
            $cache[$args['widget_id']] = ob_get_flush();
            wp_cache_set('widget_popular_posts', $cache, 'widget');
        }