Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class td_module_3 extends td_module {
- function __construct($post) {
- //run the parrent constructor
- parent::__construct($post);
- }
- function render() {
- ob_start();
- ?>
- <div class="td_mod3 td_mod_wrap <?php echo $this->get_no_thumb_class();?>" <?php echo $this->get_item_scope();?>>
- <?php echo $this->get_image('art-thumb');?>
- <div class="item-details">
- <?php echo $this->get_title(td_util::get_option('tds_mod3_title_excerpt'));?>
- <div class="meta-info">
- <?php //echo $this->get_author();?>
- <?php echo $this->get_date();?>
- <?php echo $this->get_category();?>
- <?php //echo $this->get_commentsAndViews();?>
- </div>
- </div>
- <?php echo $this->get_item_scope_meta();?>
- </div>
- <?php return ob_get_clean();
- }
- function get_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"><a ' . $td_cat_color . ' href="' . $td_cat_parms['link'] . '">' . $td_cat_name . '</a></li>';
- }
- $buffy .= '</ul>';
- return $buffy;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment