Guest User

Untitled

a guest
May 5th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. <?php
  2.  
  3. class td_module_5 extends td_module {
  4.  
  5. function __construct($post) {
  6. //run the parrent constructor
  7. parent::__construct($post);
  8. }
  9. function get_category() {
  10.  
  11. $buffy = '';
  12.  
  13. $buffy .= '<ul class="td-category">';
  14. $categories = get_the_category($this->post->ID);
  15. $cat_array = array();
  16.  
  17. if($categories){
  18. foreach($categories as $category) {
  19. if ($category->name != TD_FEATURED_CAT) { //ignore the featured category name
  20. //get the parent of this cat
  21. $td_parent_cat_obj = get_category($category->category_parent);
  22.  
  23. //if we have a parent, shot it first
  24. if (!empty($td_parent_cat_obj->name)) {
  25. $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');
  26. $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');
  27. $cat_array[$td_parent_cat_obj->name] = array(
  28. 'color' => $tax_meta__color_parent,
  29. 'link' => get_category_link($td_parent_cat_obj->cat_ID),
  30. 'hide_on_post' => $tax_meta__hide_on_post_parent
  31. );
  32. }
  33.  
  34. //show the category, only if we didn't already showed the parent
  35. $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');
  36. $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');
  37. $cat_array[$category->name] = array(
  38. 'color' => $tax_meta_color,
  39. 'link' => get_category_link($category->cat_ID),
  40. 'hide_on_post' => $tax_meta__hide_on_post_parent
  41. );
  42. }
  43. }
  44. }
  45.  
  46. foreach ($cat_array as $td_cat_name => $td_cat_parms) {
  47. if ($td_cat_parms['hide_on_post'] == 'hide') {
  48. continue;
  49. }
  50.  
  51. if (!empty($td_cat_parms['color'])) {
  52. $td_cat_color = ' style="background-color:' . $td_cat_parms['color'] . ';"';
  53. } else {
  54. $td_cat_color = '';
  55. }
  56.  
  57.  
  58. $buffy .= '<li class="entry-category"><a ' . $td_cat_color . ' href="' . $td_cat_parms['link'] . '">' . $td_cat_name . '</a></li>';
  59. }
  60. $buffy .= '</ul>';
  61.  
  62. return $buffy;
  63. }
  64. function render() {
  65. ob_start();
  66. ?>
  67.  
  68. <div class="td_mod5 td_mod_wrap <?php echo $this->get_no_thumb_class();?>" <?php echo $this->get_item_scope();?>>
  69. <?php echo $this->get_image('art-wide');?>
  70. <?php echo $this->get_title(td_util::get_option('tds_mod5_title_excerpt'));?>
  71.  
  72.  
  73. <div class="meta-info">
  74. <?php //echo $this->get_author();?>
  75. <?php echo $this->get_date();?>
  76. <?php echo $this->get_commentsAndViews();?>
  77. <?php echo $this->get_category();?>
  78. </div>
  79.  
  80. <div class="td-post-text-excerpt">
  81. <?php echo $this->get_excerpt(td_util::get_option('tds_mod5_content_excerpt'));?>
  82. </div>
  83.  
  84.  
  85. <?php echo $this->get_item_scope_meta();?>
  86. </div>
  87.  
  88. <?php return ob_get_clean();
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment