How to show different timestamp

This should do it. // See if the post is older than 24 hours. if ( get_post_time() <= strtotime( ‘-1 day’ ) ) { echo ‘Published more than 24 hours ago.’; } else { echo ‘Published within the last 24 hours.’; }

Function Reference/human time diff for future posts

You could also do it using human_time_diff hook, but it would make it global: function my_time_diff_mins( $since, $diff, $from, $to ) { return $since . ($from > $to ? ‘ from now’ : ‘ ago’); } add_filter( ‘human_time_diff’, ‘my_time_diff_mins’, 10, 4 );

Query not work for current taxonomy

It looks like your query is for ALL posts in that post type as you are overwriting $posts when using $posts = get_posts(). You need to pass the Taxonomy parameter correctly as explained here like this: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, ‘terms’ => ‘bob’, … Read more

How to get User Time Zone in WordPress?

Since WordPress is a server-side framework/CMS, it likely doesn’t have the functionality you’re looking for. If you’re looking for ways to obtain this information, the most reliable would likely be to ask the user. To make it as painless as possible for the user, this functionality could be achieved via client-side scripting (ie. JavaScript) where … Read more

How get exact time difference

human_time_diff() only returns a single {number} {unit} string back. It rounds to nearest whole unit, instead of breaking down the difference precisely. To get an exact duration difference, you’ll need to use your own function. As this is a popular need in PHP, there’s lots of solutions online – here’s a clever one I found: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)