How to add custom post meta to td_module_7

Posted in: Newsmag
Post count: 60

Everytime i try to add lets say a post_meta titled genre_text and i call it on the page as this.

<?php

class td_module_6 extends td_module {

function __construct($post) {
//run the parrent constructor
parent::__construct($post);
}

function render() {
ob_start();
?>

<div class="<?php echo $this->get_module_classes();?>" <?php echo $this->get_item_scope();?>>

<?php echo $this->get_image('td_100x75');?>
<?php $genre=get_post_meta($post->ID,'music_genre',true);;?>
<div class="item-details">
<?php echo $this->get_title();?>
<div class="meta-info">
<?php if (td_util::get_option('tds_category_module_6') == 'yes') { echo $this->get_category(); }?>
<?php //echo $this->get_author();?>
<?php echo $this->get_date();?> // <?php echo $genre;?>
<?php //echo $this->get_comments();?>
</div>
</div>
<?php echo $this->get_item_scope_meta();?>
</div>

<?php return ob_get_clean();
}
}

I just loads a blank thing and doesn’t even load

I even tried to add a custom taxonomy fetch and never worked.

Anyone know how to fix this?

Post count: 1291

Hi,

Try to replace
<?php $genre=get_post_meta($post->ID,'music_genre',true);;?>
with
<?php $genre = get_post_meta($this->post->ID,'music_genre',true);?>

Thank you, Emil G.

  • This reply was modified 11 years by Emil G.
  • This reply was modified 11 years by Emil G.
  • This reply was modified 11 years by Emil G.
Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newsmag’ is closed to new topics and replies.