Guest User

Untitled

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