Guest User

Untitled

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