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(150, false); ?> </div> </div> </article> <?php if ($i % 2 != 0) { echo '</div>'; } $i++;
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 } }
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> <?php cb_byline($cb_post_id); ?> <div class="cb-excerpt"><?php echo cb_clean_excerpt(160); ?> </div> <?php cb_post_meta($cb_post_id); ?> </div> </article>
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> <?php echo cb_byline(true, $cb_post_id, true); ?> </div> </article> <?php } } echo '</div>'; } // endif 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); $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'); }
echo '<div class="' . $cb_module_type . ' ' . $cb_module_style . ' cb-module-half clearfix">' . $cb_title_header; } ?> <article class="cb-article clearfix" role="article"> <div class="cb-meta"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php echo cb_byline(true); ?> <div class="cb-excerpt"><?php echo cb_clean_excerpt(120); ?> </div> </div> </article> <?php $cb_count++; } echo '</div>'; }
<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> <?php echo cb_review_ext_box($cb_post_id, $cb_category_color); ?> </li> <?php $cb_count++; } echo '</ul></div></div>'; } wp_reset_postdata();
function start_el(&$output, $object, $depth = 0, $args = array(), $id = 0) { parent::start_el($output, $object, $depth, $args); $cb_base_color = ot_get_option('cb_base_color', '#eb9812'); $cb_cat_menu = $object->cbmegamenu; if ($cb_cat_menu == NULL) { $cb_cat_menu = '2'; } 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'; } 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') { $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_args_featured = array('cat' => $cb_cat_id, 'post_type' => 'post', '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' => 'post', '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="' . $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_args = array('cat' => $cb_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $cb_qry_amount, 'ignore_sticky_posts' => 1); $cb_qry_latest = $cb_img = NULL; $cb_qry_latest = new WP_Query($cb_args); $i = 1; foreach ($cb_qry_latest->posts as $cb_post) { setup_postdata($cb_post); $cb_post_id = $cb_post->ID; $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="' . $cb_permalink . '">' . $cb_post->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_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' => 'post', 'post_status' => 'publish', 'posts_per_page' => 9, 'ignore_sticky_posts' => 1); } else { $cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => 'post', '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="' . $cb_permalink . '">' . $cb_img . '</a>' . cb_review_ext_box($cb_post_id, $cb_category_color) . '</div> <div class="cb-meta"> <h2><a href="' . $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"> <h2 class="cb-mega-title"><span style="border-bottom-color:' . $cb_border_color . ';">' . $cb_featured_random_title . '</span></h2> <ul>' . $cb_menu_featured . '</ul> </div> <div class="cb-recent' . $cb_big_recent . '"> <h2 class="cb-mega-title"><span style="border-bottom-color:' . $cb_border_color . ';">' . __('Recent', 'cubell') . '</span></h2> <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')); }
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'); }
$cb_title_header = NULL; } $cb_feature_width = '400'; $cb_feature_height = '250'; $cb_byline = cb_byline(true, $cb_post_id, true); if ($cb_flipped == 'cb-flipped ') { if ($i == 4 || $i == 5) { $cb_byline = $cb_feature_width = '600'; $cb_feature_height = '400'; $cb_byline = cb_byline(true, $cb_post_id, false); } } else { if ($i == 1 || $i == 2) { $cb_feature_width = '600'; $cb_feature_height = '400'; $cb_byline = cb_byline(true, $cb_post_id, false); } } if ($i == 1) { echo '<div class="cb-grid-block ' . $cb_module_style . ' clearfix">' . $cb_title_header . '<div class="cb-grid-5 ' . $cb_flipped . 'clearfix">'; } ?> <div class="cb-feature-<?php echo $i; ?> "> <div class="cb-grid-img"> <?php cb_thumbnail($cb_feature_width, $cb_feature_height); ?>
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')); }
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(); } }
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'); }
?> <div id="cb-content" class="wrap clearfix"> <div id="main" class="clearfix" role="main"> <article id="post-<?php the_ID(); ?> " <?php post_class('clearfix'); ?> role="article"> <?php echo '<div class="cb-entry-header cb-style-off"><h1 class="cb-entry-title cb-single-title">' . get_the_title() . '</h1>'; echo cb_byline(false); echo '</div>'; ?> <section class="entry-content clearfix" itemprop="articleBody"> <a href="<?php echo $cb_attachment_full[0]; ?> "> <img src="<?php echo $cb_attachment_thumb[0]; ?> " alt=""> </a> </section> <!-- end article section -->