I used the default code and it still shows the time ago on related post. I guess it’s inheriting it from the front page time ago code.
How do I set the time ago for related articles
This is the code i am using on my single.php page (post page on mobile theme)
<?php
$time = human_time_diff(get_the_time(‘U’),
current_time(‘timestamp’));
$pos = strpos($time, ‘months’);
if ($pos>0) {echo ‘<div class=”classing”>’ . $td_mod_single->get_date ( show_stars_on_review, false) . ‘</div>’;}
else {echo ‘<div class=”classing1″>’. $time . ‘ ago’. ‘</div>’;}
?>
and its bringing same time for posts and related posts
Okay thank you so much. That really helped. However the last problem I’m facing is, on my single posts (mobile theme) related posts are inheriting the date of the posts. That is, if the post has a time of 1hr ago, all related posts below the posts also have 1hr.
You can check using this post link below;
https://wizimatic.com/fresh-music-b-red-run-come-ft-cdq/
please check on mobile as i didnt edit the desktop pages
You can check on mobile.. Here is a recent post, the meta information aligns properly, http://wizimatic.com/china-releases-3-year-plan-for-air-pollution-control/
Here is a long time post; https://wizimatic.com/infantino-wants-video-refs-for-2018-world-cup/
the post meta (date) doesnt align. I use the same div class for it. Here is the code that i am using, right in single.php
<div class=”classing”><?php
$time = human_time_diff(get_the_time(‘U’),current_time(‘timestamp’));
$pos = strpos($time, ‘months’);
if ($pos>0) {
echo $td_mod_single->get_date(false);;
}
else{echo $time . ‘ ago’;}
?></div>
i used this code <?php
$time = human_time_diff(get_the_time(‘U’), current_time(‘timestamp’));
$pos = strpos($time, ‘months’);
if ($pos>0) {
echo $td_mod_single->get_date(false);;
}
else{echo $time . ‘ ago’;}
?>
but the styling class didnt work the moment the posts is over a month. The date didnt align with other metas
how can i limit the time ago to a month and it should the normal date if its more than a month
Done. How can I style the time ago on single.php posts separately. It doesn’t align, jumps up a little.
How can I include the time ago on featured posts on mobile theme
Can i use your code <?php echo human_time_diff( get_the_time(‘U’, $this->post->ID), current_time(‘timestamp’) ) . ‘ ago’; ?> for post pages (single.php) sir?
I put
<?php echo human_time_diff( get_the_time(‘U’),
current_time(‘timestamp’) ) . ‘ ago’; ?>
on my mobile front page but i need the code to put on the single.php that will show timeago for individual posts.
just wondering about the difference between the two codes which is $this->post->ID
Also, There is a dash (-) inbetween the authors name and category name on my homepage(using the newspaper mobile theme), i dont know how to hide it and make the meta info closer to each other.
Also, how do i include the time ago on the featured posts.
my url is https://wizimatic.com (pls access from mobile to see)
The styling using “myclass” worked perfectly.
how can it be styled ?