Guest User

Untitled

a guest
Sep 24th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 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.  
  11. function render() {
  12. ob_start();
  13. ?>
  14.  
  15. <div class="td_mod_wrap td_mod9 <?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_mod9_title_excerpt'));?>
  20. <div class="meta-info">
  21. <?php //echo $this->get_author();?>
  22. <ul class="td-category">
  23. <a href="#"><?php echo $this->get_category();?></a>
  24. </ul>
  25. <?php echo $this->get_date();?>
  26. <?php //echo $this->get_commentsAndViews();?>
  27. </div>
  28.  
  29.  
  30. <p><div class="td-post-text-excerpt"><?php echo $this->get_excerpt(td_util::get_option('tds_mod9_content_excerpt'));?></div></p>
  31.  
  32. <div class="more-link-wrap wpb_button td_read_more clearfix">
  33. <a href="<?php echo $this->href;?>"><?php echo __td('Continue', TD_THEME_NAME);?></a>
  34. </div>
  35.  
  36. </div>
  37.  
  38. <?php echo $this->get_item_scope_meta();?>
  39. </div>
  40.  
  41. <?php return ob_get_clean();
  42.  
  43. }
  44. function get_category() {
  45. $buffy = '';
  46.  
  47. //read the post meta to get the custom primary category
  48. $td_post_theme_settings = get_post_meta($this->post->ID, 'td_post_theme_settings', true);
  49. if (!empty($td_post_theme_settings['td_primary_cat'])) {
  50. //we have a custom category selected
  51. $selected_category_obj = get_category($td_post_theme_settings['td_primary_cat']);
  52. } else {
  53. //get one auto
  54. $categories = get_the_category($this->post->ID);
  55. if (!empty($categories[0])) {
  56. if ($categories[0]->name === TD_FEATURED_CAT and !empty($categories[1])) {
  57. $selected_category_obj = $categories[1];
  58. } else {
  59. $selected_category_obj = $categories[0];
  60. }
  61. }
  62. }
  63.  
  64. if (!empty($selected_category_obj)) { //@todo catch error here
  65. $buffy .= $selected_category_obj->name;
  66. }
  67.  
  68. //return print_r($post, true);
  69. return $buffy;
  70. }
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment