Same post date on each post…

Posted in: Newsmag
Post count: 60

Hey I am using this to call the “posted x time ago” function

<?php if (is_page()) { ?><span class="timeAgo">Posted <?php echo human_time_diff(get_the_time('U'),current_time('timestamp')).' ago';?></span><?php } else { ?><?php } ?>

But it displays the same like date (2 days ago) even when its not 2 days ago

my URL is

urbanmusichq.co

LMK

Post count: 7909

Hi,

You can edit loop-single and single-template depending the post’s template that you use and replace date: http://screencast.com/t/oU2H0hGDQhttp://screencast.com/t/URfuYUBQ2c

<?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>

Result: http://screencast.com/t/EJii2sGi

Hope this helps!

Post count: 60

If you see my main page on

UrbanMusicHQ.co

you will seeh ow thye all say

Posted 3 days ago or

Pasted 4 days ago or whatever it says now

I need it to say the right date, its like its staying in 1 query post cuz of it. Anyways I can fix this?

Post count: 7909

Hi,

My answer was for displaying date on posts. And that I tested and it’s works.
Now I see that you want to do this for modules, so this is not an easy task and you would need custom modifications to the date’s function: http://screencast.com/t/DV1r3Euyj
That date that you have now it is date when was created page/block. We would have gladly made it for you but for the moment we cannot provide custom work.

Thanks!

Post count: 60

Doesn’t it take you literally 5 minutes to do that….

Could you direct me in the right path at least?

Post count: 60

Anyways, fixed it without your help really by adding

<?php if (is_page()) { ?><span class="timeAgo">Posted <?php echo human_time_diff( get_the_time('U', $this->post->ID), current_time('timestamp') ) . ' ago'; ?></span><?php } else { ?><?php } ?>

Thanks anyways.

Post count: 7909

Hi,

You can try this solution:
1. Edit td_module.php like this : http://screencast.com/t/KjLPzbsDBxE
Code that you have to paste on else condition: http://pastebin.com/zCaDGebT
2. Change called function for modules(all modules or just that for blocks that are you using): http://screencast.com/t/1RpccM0g
Result: http://screencast.com/t/6h7ft9GqB
You can change it also for posts(or leave with that function by default get_date) if you want, by editing loop-single or single_template depending of post template that you want to use: http://screencast.com/t/6dDaUdWjb7
Result: http://screencast.com/t/ajtzdwDKjxf

Thanks!

Post count: 60

Hey I just added this in the module I use

<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();?> <span class="genreHome"><?php echo $genre;?></span>
<div class="vc_empty_space" style="height: 5px"><span class="vc_empty_space_inner"></span></div>
<?php if (is_page()) { ?><span class="timeAgo">Posted <?php echo human_time_diff( get_the_time('U', $this->post->ID), current_time('timestamp') ) . ' ago'; ?></span><?php } else { ?><?php } ?>
<?php //echo $this->get_comments();?>
</div>

Worked perfect.

Result: http://gyazo.com/3406482a39ad5d5004006f625deb5d8c

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newsmag’ is closed to new topics and replies.