help to get postid in module code

Posted in: Newsmag
Post count: 115

Hi.

I’m working on my own implementation of Disqus, and it works perfectly on the articles, but need some hele for the modules:

How do I get the permalink within this function in td_module_x.php in the theme. I tried the get_permalink($id), but it fails.

Please help 🙂

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');?>

<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();?>

<!--a href="<?php echo get_permalink($id); ?>#disqus_thread">&nbsp</a-->
<?php //echo $this->get_comments();?>
</div>
</div>
<?php echo $this->get_item_scope_meta();?>
</div>

<?php return ob_get_clean();

Post count: 44

For blocks/modules you can get the ID like this – $this->post->ID; so you can do

<?php $id = $this->post->ID; ?>
<?php echo get_permalink($id); ?>

For single pages – $td_mod_single->post->ID;

Post count: 115

Thanks a mill.

Your my knight in shining amour 🙂

/Jens

Post count: 780

@shubhra thanks for your help!

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.