<?php
get_header();
$cb_cats = get_the_category();
$cb_cat_id = get_query_var('cat');
$cb_blog_style = cb_get_blog_style();
$cb_cat_title_bg = $cb_tax_id = $cb_taxonomy = $cb_tax_qry = NULL;
$cb_archive_title_bg_src = cb_archive_title_bg();
if ( function_exists('get_tax_meta') ) {
$cb_category_color_style = get_tax_meta($cb_cat_id, 'cb_cat_style_color');
$cb_featured_option = get_tax_meta($cb_cat_id, 'cb_cat_featured_op');
$cb_category_ad = get_tax_meta_strip($cb_cat_id, 'cb_cat_ad');
$cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
if ( ($cb_category_color == '#' ) || ( $cb_category_color == NULL ) ) {
$cb_parent_cat_id = $cb_cats[0]->parent;
if ($cb_parent_cat_id != '0') {
$cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id');
}
}
} else {
$cb_category_color = $cb_category_ad = NULL;
$cb_featured_option = 'Off';
}
if ( ($cb_category_color == NULL) || ($cb_category_color == '#')) {
$cb_category_color = ot_get_option('cb_base_color', '#eb9812');
}
if ( isset( $cb_archive_title_bg_src[1] ) ) {
$cb_cat_title_bg = 'data-cb-bg="' . $cb_archive_title_bg_src[1] . '"';
}
?>
<div id="cb-content" class="wrap clearfix">
<div id="cb-cat-header" class="cb-cat-header cb-section-header" style="border-bottom-color:<?php echo $cb_category_color; ?>;" <?php echo $cb_cat_title_bg; ?>>
<h1 id="cb-cat-title"><?php echo get_category(get_query_var('cat'))- >name; ?></h1>
<?php echo category_description( $cb_cat_id ); ?>
</div>
<div class="clearfix">
<div id="main" class="cb-main clearfix cb-module-block cb-blog-style-roll">
<?php
$term = get_queried_object();
$children = get_terms( $term->taxonomy, array(
'parent' => $term->term_id,
'hide_empty' => true
) );
$cb_count = 1;
$cb_counter = 1;
if($children) {
foreach($children as $child){
if ( ( $cb_blog_style == 'style-b' || $cb_blog_style == 'style-e' ) && $cb_count == 3 ) { $cb_count = 1; }
if ( $cb_blog_style == 'style-c' && $cb_count == 4 ) { $cb_count = 1; }
if ( $cb_blog_style == 'style-g' && $cb_counter == 4 ) { $cb_counter = 1; }
if($cb_blog_style == 'style-a'){ $image_size="cb-360-240"; $post_class="cb-blog-style-a cb-blog-style cb-color-hover cb-separated clearfix"; }
if($cb_blog_style == 'style-b'){ $image_size="cb-360-240"; $post_class = "cb-blog-style-b cb-blog-style cb-color-hover cb-article-row-2 cb-article-row cb-separated clearfix cb-no-$cb_count";}
if($cb_blog_style == 'style-c'){ $image_size="cb-360-240"; $post_class = "cb-blog-style-c cb-blog-style cb-color-hover cb-article-row-3 cb-article-row cb-separated clearfix cb-no-$cb_count";}
if($cb_blog_style == 'style-d'){ $image_size="cb-750-400"; $post_class = "cb-blog-style-d cb-blog-style cb-color-hover cb-separated clearfix";}
if($cb_blog_style == 'style-e'){ $image_size="cb-300-250"; $post_class = "cb-blog-style-e cb-small cb-blog-style cb-color-hover cb-article-row-2 cb-article-row cb-separated clearfix cb-no-$cb_count";}
if($cb_counter % 3 == 0 && $cb_blog_style == 'style-f'){ $image_size="cb-750-400"; $post_class = "cb-blog-style-d cb-blog-style cb-color-hover cb-separated clearfix";}
if($cb_counter % 3 != 0 && $cb_blog_style == 'style-f'){ $image_size="cb-360-240"; $post_class="cb-blog-style-a cb-blog-style cb-color-hover cb-separated clearfix";}
if($cb_counter % 3 == 0 && $cb_blog_style == 'style-g'){ $image_size="cb-750-400"; $post_class = "cb-blog-style-d cb-blog-style cb-color-hover cb-separated clearfix";}
if($cb_counter % 3 != 0 && $cb_blog_style == 'style-g'){ $image_size="cb-360-240"; $post_class = "cb-blog-style-b cb-blog-style cb-color-hover cb-article-row-2 cb-article-row cb-separated clearfix cb-no-$cb_counter";}
?>
<article <?php post_class( $post_class ); ?> >
<div class="cb-mask" style="background-color:<?php echo $cb_category_color; ?>;">
<a href="https://wordpress.stackexchange.com/questions/250023/<?php echo get_term_link($child->term_id); ?>">
<?php z_taxonomy_image($child->term_id, $image_size ); ?>
</a>
</div>
<div class="cb-meta">
<h2 class="cb-post-title">
<a href="https://wordpress.stackexchange.com/questions/250023/<?php echo get_term_link($child->term_id); ?>">
<?php echo $child->name; ?>
</a>
</h2>
<?php if ($cb_blog_style != 'style-e') { ?> <div class="cb-excerpt"><?php echo $child->description; ?></div> <?php } ?>
</div>
</article>
<?php
$cb_count++;
$cb_counter++;
}
}
else {
if ( $cb_category_ad != NULL ) {
echo '<div class="cb-category-top">' . do_shortcode( $cb_category_ad ) . '</div>';
}
if ( $cb_featured_option == 'slider' ) {
$cb_section = $cb_title = $cb_module_style = $j = NULL;
include( locate_template( 'library/modules/cb-s-2.php' ) );
}
include( locate_template( 'cat-' . $cb_blog_style . '.php') );
}
?>
</div> <!-- /main -->
<?php if ( $cb_blog_style != 'style-c' ) { get_sidebar(); } ?>
</div>