Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_custom_category() {
- $buffy = '';
- $buffy .= '<ul class="td-category">';
- $categories = get_the_category($this->post->ID);
- $cat_array = array();
- if($categories){
- foreach($categories as $category) {
- if ($category->name != TD_FEATURED_CAT) { //ignore the featured category name
- //get the parent of this cat
- $td_parent_cat_obj = get_category($category->category_parent);
- //if we have a parent, shot it first
- if (!empty($td_parent_cat_obj->name)) {
- $tax_meta__color_parent = td_util::get_category_option($td_parent_cat_obj->cat_ID,'tdc_color');//swich by RADU A, get_tax_meta($td_parent_cat_obj->cat_ID,'tdc_color');
- $tax_meta__hide_on_post_parent = td_util::get_category_option($td_parent_cat_obj->cat_ID,'tdc_hide_on_post');//swich by RADU A, get_tax_meta($td_parent_cat_obj->cat_ID,'tdc_hide_on_post');
- $cat_array[$td_parent_cat_obj->name] = array(
- 'color' => $tax_meta__color_parent,
- 'link' => get_category_link($td_parent_cat_obj->cat_ID),
- 'hide_on_post' => $tax_meta__hide_on_post_parent
- );
- }
- //show the category, only if we didn't already showed the parent
- $tax_meta_color = td_util::get_category_option($category->cat_ID,'tdc_color');//swich by RADU A, get_tax_meta($category->cat_ID,'tdc_color');
- $tax_meta__hide_on_post_parent = td_util::get_category_option($category->cat_ID,'tdc_hide_on_post');//swich by RADU A, get_tax_meta($category->cat_ID,'tdc_hide_on_post');
- $cat_array[$category->name] = array(
- 'color' => $tax_meta_color,
- 'link' => get_category_link($category->cat_ID),
- 'hide_on_post' => $tax_meta__hide_on_post_parent
- );
- }
- }
- }
- foreach ($cat_array as $td_cat_name => $td_cat_parms) {
- if ($td_cat_parms['hide_on_post'] == 'hide') {
- continue;
- }
- if (!empty($td_cat_parms['color'])) {
- $td_cat_color = ' style="background-color:' . $td_cat_parms['color'] . ';"';
- } else {
- $td_cat_color = '';
- }
- $buffy .= '<li class="entry-category"><span>' . $td_cat_name . '</span></li>';
- }
- $buffy .= '</ul>';
- return $buffy;
- }
Advertisement
Add Comment
Please, Sign In to add comment