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
Hi,
You can edit loop-single and single-template depending the post’s template that you use and replace date: http://screencast.com/t/oU2H0hGDQ – http://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!
-
This reply was modified 11 years by
Alin [tagDiv].
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?
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!
-
This reply was modified 11 years by
Alin [tagDiv].
Doesn’t it take you literally 5 minutes to do that….
Could you direct me in the right path at least?
-
This reply was modified 11 years by
DavisBeatz.
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.
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!
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.
