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)) { $cb_hp_infinite = 'infinite-load'; } cb_page_navi($cb_hp_infinite); }
function cb_related_posts_block() { 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_show = ot_get_option('cb_related_posts_show', 'both'); $cb_related_posts_order = ot_get_option('cb_related_posts_order', 'rand'); $cb_blog_style = ot_get_option('cb_related_posts_style', '2'); $cb_related_posts_amount_full = $cb_related_posts_amount * 1.5; $cb_block_title = __('Related Articles', 'cubell'); $cb_classes = 'cb-row-article clearfix cb-blog-style'; if ($cb_blog_style == 1) { $cb_posts_per_row = 1; $cb_width = '1400'; $cb_height = '580'; $cb_classes .= ' cb-row-1'; } if ($cb_blog_style == 2) { $cb_posts_per_row = 2; $cb_width = '800'; $cb_height = '550'; $cb_classes .= ' cb-row-2'; } if ($cb_blog_style == 3) { $cb_posts_per_row = 3; $cb_width = '550'; $cb_height = '430'; $cb_classes .= ' cb-row-3'; } $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($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_number_related, '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_number_related, '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) { echo '<div id="cb-related-posts" class="clearfix"><h3 class="cb-tags-title cb-body-font cb-footer-title">' . $cb_block_title . '</h3>'; 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); ?> <article id="post-<?php the_ID(); ?> " <?php post_class($cb_classes); ?> role="article"> <div class="cb-article-area"> <div class="cb-mask"> <?php cb_thumbnail($cb_post_id, $cb_width, $cb_height); ?> </div> <?php cb_post_meta_wrap($cb_post_id, $cb_like_count = 'on'); ?> </div> </article> <?php $i++; } echo '</div>'; wp_reset_postdata(); } }