Guest User

Untitled

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