protected function content($atts, $content = null) { extract(shortcode_atts(array('tax_select' => '1', 'ids' => '', 'colors' => '#ffd87c|#f7d7c2|#a7d3e0', 'style' => '1'), $atts)); // $width_class = ''; // $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $width_class, $this->settings['base'], $atts ); switch ($tax_select) { case '1': $tax = 'category'; $posttype = 'post'; break; case '2': $tax = 'product_cat'; $posttype = 'product'; break; case '3': $tax = 'projects_cat'; $posttype = 'our-projects'; break; default: $tax = 'category'; $posttype = 'post'; break; } $args = array('type' => $posttype, 'include' => $ids, 'taxonomy' => $tax); $categories = get_categories($args); $bg_colors = explode('|', $colors); ob_start(); ?> <?php if ($style != '4') { ?> <div class="<?php echo $style == '1' ? 'categories_wrap_container' : 'cat_wrap_container'; ?> "> <?php $counter = 0; foreach ($categories as $category) { $term_link = get_term_link($category); if ($posttype == 'post' || $posttype == 'our-projects') { $taxonomy_image = Taxonomy_MetaData::get($tax, $category->term_id, '_cmb_tax_img'); } else { $thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true); $taxonomy_image = wp_get_attachment_url($thumbnail_id); } ?> <?php if ($style == '1' || $style == '2') { ?> <div <?php echo $style == '2' ? 'style="background-color:' . esc_attr($bg_colors[$counter]) . ';"' : ''; ?> > <h3><a href="<?php echo esc_url($term_link); ?> "><?php echo esc_html($category->name); ?> </a></h3> <?php if (!empty($category->description) && $style == '1') { ?> <?php echo apply_filters('the_content', $category->description); ?> <?php } ?> <a href="<?php echo esc_url($term_link); ?> "><span class="icon icon-arrow-right"></span></a> </div> <?php } else { ?> <div class="cat_img_wraper" <?php echo !empty($taxonomy_image) ? 'style="background-image: url(' . esc_url($taxonomy_image) . ');"' : ''; ?> > <div> <h2><a href="<?php echo esc_url($term_link); ?> "><?php echo esc_html($category->name); ?> </a></h2> <?php echo apply_filters('the_content', $category->description); ?> </div> </div> <?php } ?> <?php $counter++; } ?> </div> <?php } else { ?> <div class="titled_categories"> <?php $counter = 1; foreach ($categories as $category) { $term_link = get_term_link($category); if ($posttype == 'post' || $posttype == 'our-projects') { $taxonomy_image = Taxonomy_MetaData::get($tax, $category->term_id, '_cmb_tax_img'); $image_ID = theShop_url_to_ID($taxonomy_image); } else { $thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true); $taxonomy_image = wp_get_attachment_url($thumbnail_id); $image_ID = theShop_url_to_ID($taxonomy_image); } ?> <div class="<?php echo $counter == 1 || $counter == 2 ? 'two_cols' : 'three_cols'; ?> "> <a href="<?php echo esc_url($term_link); ?> "> <div><span><?php echo esc_html($category->name); ?> </span></div> <?php echo wp_get_attachment_image($image_ID, 'cat-thumbnail', true); ?> </a> </div> <?php $counter++; } ?> </div> <?php } ?> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
<?php /** * The template for displaying Archive pages */ get_header(); $taxonomy = 'category'; $term_id = get_queried_object_id(); $term = get_queried_object(); $category_info = Taxonomy_MetaData::get($taxonomy, $term_id); ?> <div class="large-title bg-<?php print !empty($category_info['color']) ? $category_info['color'] : 'teal'; ?> "> <div class="wrap"> <?php if (!empty($category_info['icon'])) { ?> <div class="large-title-icon bg-<?php print !empty($category_info['color']) ? $category_info['color'] : 'teal'; ?> "> <img src="<?php print $category_info['icon']; ?> "> </div> <?php } ?>