</div> </article> <?php } else { ?> <article class="cb-article cb-small clearfix" role="article"> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> "> <?php cb_thumbnail('80', '60'); echo cb_review_ext_box($cb_post_id, $cb_category_color, true); echo $cb_post_format_icon; ?> </div> <div class="cb-meta"> <h2 class="h4"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2>
$cb_feature_height = '300'; $cb_feature_tile_size = 'cb-m'; } } if ($i == 1) { echo '<div class="cb-grid-block cb-module-block' . $cb_no_sidebar . ' clearfix">' . $cb_title_header . '<div class="cb-grid-x cb-grid-' . $cb_ppp . ' clearfix">'; } ?> <div <?php post_class('cb-grid-feature cb-feature-' . esc_attr($i) . ' ' . esc_attr($cb_feature_tile_size) . ' ' . ot_get_option('cb_grid_tile_design', 'cb-meta-style-4') . ' clearfix'); ?> > <div class="cb-grid-img"> <?php cb_thumbnail($cb_feature_width, $cb_feature_height); ?> </div> <div class="cb-article-meta"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php cb_byline($cb_post_id); ?> </div>
while ($cb_qry->have_posts()) { $cb_qry->the_post(); $cb_post_id = $post->ID; $cb_category_color = cb_get_cat_color($cb_post_id); if ($cb_title != NULL) { $cb_title_header = '<div class="cb-module-header" style="border-bottom-color:' . $cb_category_color . ';"><h2 class="cb-module-title" >' . $cb_title . '</h2>' . $cb_subtitle . '</div>'; $cb_title_placeholder = NULL; } if ($cb_count == 1) { echo '<div class="' . $cb_module_type . ' ' . $cb_module_style . ' ' . $cb_title_placeholder . 'clearfix"' . $cb_slider_ltr_rtl . '>' . $cb_title_header . '<div class="' . $cb_slider_type . ' clearfix"><ul class="slides">'; } ?> <li> <?php cb_thumbnail('282', '232'); ?> <div class="cb-meta"> <h2><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h2> <?php echo cb_byline(false, $cb_post_id, true); ?> </div>
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'); }
function cb_sidebar_post() { $cb_sidebar_posts = ot_get_option('cb_sidebar_posts', 'on'); $cb_sidebar_posts_title = ot_get_option('cb_sidebar_posts_title', NULL); $cb_sidebar_posts_filter = ot_get_option('cb_sidebar_posts_filter', 'rand'); $cb_sidebar_posts_number = ot_get_option('cb_sidebar_posts_number', '2'); $cb_sidebar_posts_likes = ot_get_option('cb_sidebar_posts_likes', 'on'); $cb_output = $cb_meta_value = NULL; if ($cb_sidebar_posts == 'on') { if ($cb_sidebar_posts_filter == 'meta_value_num') { $cb_meta_value = 'cb_post_like_count'; } $cb_qry = new WP_Query(array('posts_per_page' => $cb_sidebar_posts_number, 'orderby' => $cb_sidebar_posts_filter, 'meta_key' => $cb_meta_value, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)); if ($cb_qry->have_posts()) { $cb_post_classes = array('clearfix', 'cb-menu-post', 'cb-' . $cb_sidebar_posts_number); echo '<span class="cb-sidebar-post-title cb-sidebar-post-meta">' . $cb_sidebar_posts_title . '</span>'; while ($cb_qry->have_posts()) { $cb_qry->the_post(); global $post; $cb_post_id = $post->ID; ?> <div <?php post_class($cb_post_classes); ?> > <div class="cb-mask"> <?php cb_thumbnail($cb_post_id, '550', '430', false); ?> </div> <?php if ($cb_sidebar_posts_likes == 'on') { echo cb_get_like_count($cb_post_id); } ?> <a href="<?php the_permalink(); ?> " class="cb-link-overlay"></a> </div> <?php } } wp_reset_postdata(); } echo $cb_output; }
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); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'cubell') : $instance['title'], $instance, $this->id_base); $category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base); $type = apply_filters('widget_type', empty($instance['type']) ? 'cb-small' : $instance['type'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 5; } if ($category != 'cb-all') { $cb_cat_qry = $category; } else { $cb_cat_qry = NULL; } $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'category_name' => $cb_cat_qry, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($r->have_posts()) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="cb-light <?php echo $type; ?> "> <?php while ($r->have_posts()) { $r->the_post(); global $post; $cb_custom_fields = get_post_custom(); $cb_global_color = ot_get_option('cb_base_color', '#eb9812'); $cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on'); $cb_review_checkbox = get_post_meta(get_the_id(), "cb_review_checkbox"); if ($type == 'cb-small') { $width = '80'; $height = '60'; $cb_small_box = true; $cb_class = NULL; } if ($type == 'cb-big') { $width = '360'; $height = '240'; $cb_small_box = false; $cb_class = ' class="h2"'; } $cb_all_categories = get_the_category(); $cb_current_cat_id = $cb_all_categories[0]->term_id; $cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id'); if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_parent_cat_id = $cb_all_categories[0]->parent; if ($cb_parent_cat_id != '0') { $cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id'); } if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_category_color = $cb_global_color; } } $cb_post_id = $post->ID; $cb_post_format_icon = cb_post_format_check($cb_post_id); ?> <li class="cb-article clearfix"> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> ;"> <?php cb_thumbnail($width, $height); echo cb_review_ext_box($cb_post_id, $cb_category_color, $cb_small_box); echo $cb_post_format_icon; ?> </div> <div class="cb-meta"> <h4<?php echo $cb_class; ?> ><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <?php echo cb_byline(false, $cb_post_id, true); ?> <?php if ($type == 'cb-big') { echo '<div class="cb-excerpt">' . cb_clean_excerpt(120) . '</div>'; } ?> </div> </li> <?php } ?> </ul> <?php echo $after_widget; ?> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_recent_posts', $cache, 'widget'); }
if (is_sticky()) { echo ' sticky'; } echo $cb_side; if ($cb_category_color_style != NULL) { echo ' ' . $cb_category_color_style; } ?> " role="article"> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> ;"> <?php cb_thumbnail('360', '240'); echo cb_review_ext_box($cb_post_id, $cb_category_color); echo $cb_post_format_icon; ?> </div> <div class="cb-meta"> <h2 class="h4"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php
?> <article id="post-<?php the_ID(); ?> " <?php post_class('cb-blog-style-a cb-module-e cb-separated clearfix'); ?> role="article"> <div class="cb-mask cb-img-fw" <?php cb_img_bg_color($cb_post_id); ?> > <?php cb_thumbnail('260', '170'); ?> <?php cb_review_ext_box($cb_post_id); ?> </div> <div class="cb-meta clearfix"> <h2 class="cb-post-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2>
function cb_related_posts() { global $post; $cb_post_id = $post->ID; $i = 1; $cb_related_posts_amount = floatval(ot_get_option('cb_related_posts_amount', '2')); $cb_related_posts_amount_full = $cb_related_posts_amount * 1.5; $cb_full_width_post = get_post_meta($cb_post_id, 'cb_full_width_post', true); if ($cb_full_width_post == 'nosidebar') { $cb_number_related = $cb_related_posts_amount_full; } else { $cb_number_related = $cb_related_posts_amount; } $cb_tags = wp_get_post_tags($post->ID); $cb_tag_check = $cb_all_cats = $cb_related_args = $cb_related_posts = NULL; if ($cb_tags != NULL) { foreach ($cb_tags as $cb_tag) { $cb_tag_check .= $cb_tag->slug . ','; } $cb_related_args = array('numberposts' => $cb_number_related, 'tag' => $cb_tag_check, 'exclude' => $cb_post_id, 'post_status' => 'publish', 'orderby' => 'rand'); $cb_related_posts = get_posts($cb_related_args); } else { $cb_categories = get_the_category(); foreach ($cb_categories as $cb_category) { $cb_all_cats .= $cb_category->term_id . ','; } $cb_related_args = array('numberposts' => $cb_number_related, 'category' => $cb_all_cats, 'exclude' => $cb_post_id, 'post_status' => 'publish', 'orderby' => 'rand'); $cb_related_posts = get_posts($cb_related_args); } if ($cb_related_posts != NULL) { echo '<div id="cb-related-posts" class="clearfix"><h3 class="cb-block-title">' . __('Related Posts', 'cubell') . '</h3><ul>'; foreach ($cb_related_posts as $post) { $cb_post_id = $post->ID; $cb_global_color = ot_get_option('cb_base_color', '#eb9812'); $cb_cat_id = get_the_category(); if (function_exists('get_tax_meta')) { $cb_current_cat_id = $cb_cat_id[0]->term_id; $cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id'); if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_parent_cat_id = $cb_cat_id[0]->parent; if ($cb_parent_cat_id != '0') { $cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id'); } if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_category_color = $cb_global_color; } } } else { $cb_category_color = NULL; } setup_postdata($post); ?> <li class="no-<?php echo $i; ?> "> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> ;"><?php cb_thumbnail('360', '240'); echo cb_review_ext_box($cb_post_id, $cb_category_color); ?> </div> <div class="cb-meta"> <h4><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h4> <?php echo cb_byline(false); ?> </div> </li> <?php $i++; } echo '</ul></div>'; wp_reset_postdata(); } }
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'); }
" class="cb-blog-style-d clearfix<?php if (is_sticky()) { echo ' sticky'; } if ($cb_category_color_style != NULL) { echo ' ' . $cb_category_color_style; } ?> " role="article"> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> ;"> <?php cb_thumbnail('750', '400'); echo cb_review_ext_box($cb_post_id, $cb_category_color); echo $cb_post_format_icon; ?> </div> <div class="cb-meta"> <h2 class="h4"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php
?> <article id="post-<?php the_ID(); ?> " <?php post_class('cb-blog-style-d cb-module-d cb-separated cb-img-above-meta clearfix'); ?> role="article"> <div class="cb-mask cb-img-fw" <?php cb_img_bg_color($cb_post_id); ?> > <?php cb_thumbnail('759', '500'); ?> <?php cb_review_ext_box($cb_post_id); ?> </div> <div class="cb-meta clearfix"> <h2 class="cb-post-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2>
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'); }
function cb_related_posts() { if (ot_get_option('cb_related_onoff', 'on') == 'off') { return; } global $post; $cb_post_id = $post->ID; $i = 1; $cb_slide_el = $cb_slide_el_cl = $cb_stop_at_2 = NULL; $cb_related_posts_show = ot_get_option('cb_related_posts_show', 'both'); $cb_related_posts_order = ot_get_option('cb_related_posts_order', 'rand'); $cb_related_posts_style = ot_get_option('cb_related_posts_style', 'cb_related_posts_slider'); if ($cb_related_posts_style == 'cb_related_posts_slider') { $cb_related_posts_amount = 8; $cb_slide_el = '<div id="cb-related-posts" class="cb-slider-2 cb-slider cb-meta-below">'; $cb_slide_el_cl = '</div>'; } else { $cb_related_posts_amount = floatval(ot_get_option('cb_related_posts_amount', '1') * 2); } $cb_tags = wp_get_post_tags($cb_post_id); $cb_tag_check = $cb_all_cats = $cb_related_args = $cb_related_posts = NULL; if ($cb_related_posts_show == 'both' || $cb_related_posts_show == 'tags') { if ($cb_tags != NULL) { foreach ($cb_tags as $cb_tag) { $cb_tag_check .= $cb_tag->slug . ','; } $cb_related_args = array('numberposts' => $cb_related_posts_amount, 'tag' => $cb_tag_check, 'exclude' => $cb_post_id, 'post_status' => 'publish', 'orderby' => $cb_related_posts_order); $cb_related_posts = get_posts($cb_related_args); } } if ($cb_related_posts_show == 'both' || $cb_related_posts_show == 'cats') { if ($cb_related_posts == NULL) { $cb_categories = get_the_category(); foreach ($cb_categories as $cb_category) { $cb_all_cats .= $cb_category->term_id . ','; } $cb_related_args = array('numberposts' => $cb_related_posts_amount, 'category' => $cb_all_cats, 'exclude' => $cb_post_id, 'post_status' => 'publish', 'orderby' => $cb_related_posts_order); $cb_related_posts = get_posts($cb_related_args); } } if ($cb_related_posts != NULL) { if (count($cb_related_posts) < 4) { $cb_slide_el = $cb_slide_el_cl = NULL; $cb_stop_at_2 = true; } echo '<div id="cb-related-posts-block" class="cb-post-footer-block cb-arrows-tr cb-module-block clearfix"><h3 class="cb-title cb-title-header">' . __('Related Posts', 'cubell') . '</h3>' . $cb_slide_el . '<ul class="slides clearfix">'; foreach ($cb_related_posts as $post) { if ($i == 3) { $i = 1; if ($cb_stop_at_2 == true) { break; } } $cb_post_id = $post->ID; setup_postdata($post); ?> <li <?php post_class('cb-style-1 clearfix cb-no-' . $i); ?> > <div class="cb-mask"><?php cb_thumbnail('360', '240', $post->ID); ?> </div> <div class="cb-meta"> <h4 class="cb-post-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <?php cb_byline($cb_post_id); ?> </div> </li> <?php $i++; } echo '</ul></div>'; echo $cb_slide_el_cl; wp_reset_postdata(); } }
if (is_sticky()) { echo ' sticky'; } if ($cb_category_color_style != NULL) { echo ' ' . $cb_category_color_style; } ?> " role="article"> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> ;"> <?php cb_thumbnail('300', '200'); echo cb_review_ext_box($cb_post_id, $cb_category_color); echo $cb_post_format_icon; ?> </div> <div class="cb-meta"> <h2 class="h4"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2>
</div> </article> <?php } else { ?> <article class="cb-article-small cb-separated clearfix" role="article"> <div class="cb-mask cb-img-fw" <?php cb_img_bg_color($cb_post_id); ?> > <?php cb_thumbnail('100', '65'); ?> <?php cb_review_ext_box($cb_post_id, true); ?> </div> <div class="cb-meta"> <h2 class="cb-post-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2>
while ($cb_qry->have_posts()) { $cb_qry->the_post(); $cb_post_id = $post->ID; $cb_category_color = cb_get_cat_color($cb_post_id); if ($cb_title != NULL) { $cb_title_header = '<div class="cb-module-header" style="border-bottom-color:' . $cb_category_color . ';"><h2 class="cb-module-title" >' . $cb_title . '</h2>' . $cb_subtitle . '</div>'; } if ($cb_count == 1) { echo '<div class="' . $cb_module_type . ' ' . $cb_module_style . ' clearfix"' . $cb_slider_ltr_rtl . '>' . $cb_title_header . '<div class="' . $cb_slider_type . ' clearfix"><ul class="slides">'; } ?> <li> <?php cb_thumbnail($cb_img_width, $cb_img_height); ?> <div class="cb-meta"> <h2><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h2> <?php echo cb_byline(); ?> </div>
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); $title = apply_filters('widget_title', empty($instance['title']) ? __('Top Reviews', 'cubell') : $instance['title'], $instance, $this->id_base); $cb_category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base); $cb_filter = apply_filters('widget_filter', empty($instance['filter']) ? '' : $instance['filter'], $instance, $this->id_base); $cb_type = apply_filters('widget_type', empty($instance['type']) ? '' : $instance['type'], $instance, $this->id_base); 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_filter == 'week') { $cb_week = date('W'); $cb_year = date('Y'); $cb_qry = new WP_Query(apply_filters('widget_posts_args', array('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' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true))); } elseif ($cb_filter == 'alltime') { $cb_qry = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => 'meta_value_num', 'order' => 'DESC', '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(apply_filters('widget_posts_args', array('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' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true))); } elseif ($cb_filter == '2011' || $cb_filter == '2012' || $cb_filter == '2013' || $cb_filter == '2014') { $cb_qry = new WP_Query(apply_filters('widget_posts_args', array('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' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true))); } if ($cb_qry->have_posts()) { echo $before_widget; if ($title != NULL) { echo $before_title . $title . $after_title; } echo '<ul>'; $i = 1; while ($cb_qry->have_posts()) { $cb_qry->the_post(); global $post; $cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on'); $cb_global_color = ot_get_option('cb_base_color', '#eb9812'); $cb_cat_id = get_the_category(); $cb_current_cat_id = $cb_cat_id[0]->term_id; $cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id'); if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_parent_cat_id = $cb_cat_id[0]->parent; if ($cb_parent_cat_id != '0') { $cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id'); } if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_category_color = $cb_global_color; } } $cb_post_id = $post->ID; ?> <li class="cb-article clearfix" style="border-top-color:<?php echo $cb_category_color; ?> ;"> <div class="cb-mask"><?php cb_thumbnail('430', '270'); ?> </div> <div class="cb-meta"> <h4><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h4> <?php echo cb_byline(false); ?> </div> <div class="cb-countdown header-font"><?php echo $i; ?> </div> <?php if ($cb_type != 'cb-reader-score') { echo cb_review_ext_box($cb_post_id, $cb_category_color); } ?> </li> <?php $i++; } echo '</ul>'; echo $after_widget; // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_top_reviews', $cache, 'widget'); }
function my_posts_screen_content() { get_template_part('directory-to-content-file'); $theuser = bp_displayed_user_id(); $paged = get_query_var('paged') ? get_query_var('paged') : 1; query_posts(array('posts_per_page' => 5, 'author' => $theuser, 'cb_offset_loop' => $cb_offset_loop, 'paged' => $paged)); if (have_posts()) { while (have_posts()) { the_post(); ?> <article id="post-<?php the_ID(); ?> " class="cb-blog-style-a clearfix<?php if (is_sticky()) { echo ' sticky'; } if ($cb_category_color_style != NULL) { echo ' ' . $cb_category_color_style; } ?> " role="article"> <div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?> ;"> <?php cb_thumbnail('300', '200'); echo cb_review_ext_box($cb_post_id, $cb_category_color); echo $cb_post_format_icon; ?> </div> <div class="cb-meta"> <h2 class="h4"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php echo cb_byline(); ?> <div class="cb-excerpt"><?php echo cb_clean_excerpt(210, false); ?> </div> </div> </article> <?php } wp_reset_query(); // resets main query } else { ?> <h1>Sorry...</h1> <p><?php _e('You have not posted any article.'); ?> </p> <h4> <a style="color: grey" href="<?php echo home_url(); ?> //add-new/"><?php esc_html_e("Add an article now", 'cubell'); ?> </a></h4> <?php } }
} else { $cb_featured_qry = array('post_type' => 'post', 'meta_key' => 'cb_featured_post', 'posts_per_page' => '12', 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish', 'meta_value' => 'featured', 'meta_compare' => '==', 'ignore_sticky_posts' => true); $cb_qry = new WP_Query($cb_featured_qry); if ($cb_qry->post_count == 0) { $cb_qry = NULL; $cb_qry = new WP_Query(array('posts_per_page' => '12', 'no_found_rows' => true, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => true)); } } if ($cb_qry->have_posts()) { while ($cb_qry->have_posts()) { $cb_qry->the_post(); ?> <li> <?php cb_thumbnail('1200', '520'); ?> <div class="cb-meta"> <h2><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h2> <?php echo cb_byline(); ?> </div> <a href="<?php the_permalink();
?> " <?php post_class($cb_classes); ?> role="article"> <div class="cb-article-area"> <div class="cb-mask"> <?php if ($cb_post_format != NULL) { echo $cb_post_format; } ?> <?php cb_thumbnail($cb_post_id, $cb_width, $cb_height); ?> </div> <?php cb_post_meta_wrap($cb_post_id, $cb_like_count = 'on', $cb_link_overlay, $cb_excerpt); ?> </div> </article> <?php } if (!isset($cb_hp_infinite)) {
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); $title = apply_filters('widget_title', empty($instance['title']) ? __('Latest', 'cubell') : $instance['title'], $instance, $this->id_base); $category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 6; } if ($category != 'cb-all') { $cb_cat_qry = $category; } else { $cb_cat_qry = NULL; } $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'category_name' => $cb_cat_qry, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($r->have_posts()) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="flexslider-widget"> <ul class="slides"> <?php while ($r->have_posts()) { $r->the_post(); global $post; $format = get_post_format(); $cb_custom_fields = get_post_custom(); $cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on'); $cb_global_color = ot_get_option('cb_base_color', '#eb9812'); $cb_review_checkbox = get_post_meta(get_the_id(), "cb_review_checkbox"); $cb_cat_id = get_the_category(); $cb_current_cat_id = $cb_cat_id[0]->term_id; $cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id'); if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_parent_cat_id = $cb_cat_id[0]->parent; if ($cb_parent_cat_id != '0') { $cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id'); } if ($cb_category_color == "#" || $cb_category_color == NULL) { $cb_category_color = $cb_global_color; } } $cb_post_id = $post->ID; if ($cb_review_checkbox) { $format = 'false'; } ?> <li class="cb-article clearfix" style="border-top-color:<?php echo $cb_category_color; ?> ;"> <div class="cb-mask"><?php cb_thumbnail('430', '270'); ?> </div> <div class="cb-meta"> <h4><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h4> <?php echo cb_byline(false); ?> </div> <?php echo cb_review_ext_box($cb_post_id, $cb_category_color); ?> </li> <?php } ?> </ul> </div> <?php echo $after_widget; ?> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_recent_posts_slider', $cache, 'widget'); }