Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class td_module_9 extends td_module {
- function __construct($post) {
- //run the parrent constructor
- parent::__construct($post);
- }
- function render() {
- ob_start();
- ?>
- <div class="td_mod_wrap td_mod9 <?php echo $this->get_no_thumb_class();?>" <?php echo $this->get_item_scope();?>>
- <?php echo $this->get_image('art-big-1col');?>
- <div class="item-details">
- <?php echo $this->get_title(td_util::get_option('tds_mod9_title_excerpt'));?>
- <div class="meta-info">
- <?php //echo $this->get_author();?>
- <ul class="td-category">
- <a href="#"><?php echo $this->get_category();?></a>
- </ul>
- <?php echo $this->get_date();?>
- <?php //echo $this->get_commentsAndViews();?>
- </div>
- <p><div class="td-post-text-excerpt"><?php echo $this->get_excerpt(td_util::get_option('tds_mod9_content_excerpt'));?></div></p>
- <div class="more-link-wrap wpb_button td_read_more clearfix">
- <a href="<?php echo $this->href;?>"><?php echo __td('Continue', TD_THEME_NAME);?></a>
- </div>
- </div>
- <?php echo $this->get_item_scope_meta();?>
- </div>
- <?php return ob_get_clean();
- }
- function get_category() {
- $buffy = '';
- //read the post meta to get the custom primary category
- $td_post_theme_settings = get_post_meta($this->post->ID, 'td_post_theme_settings', true);
- if (!empty($td_post_theme_settings['td_primary_cat'])) {
- //we have a custom category selected
- $selected_category_obj = get_category($td_post_theme_settings['td_primary_cat']);
- } else {
- //get one auto
- $categories = get_the_category($this->post->ID);
- if (!empty($categories[0])) {
- if ($categories[0]->name === TD_FEATURED_CAT and !empty($categories[1])) {
- $selected_category_obj = $categories[1];
- } else {
- $selected_category_obj = $categories[0];
- }
- }
- }
- if (!empty($selected_category_obj)) { //@todo catch error here
- $buffy .= $selected_category_obj->name;
- }
- //return print_r($post, true);
- return $buffy;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment