wordpress blog posts’s time

In your template where you see the_title(), you will want to change it to something along the following: echo get_the_title() . ‘, ‘ . ‘posted by ‘ . get_the_author() . ‘, ‘ . human_time_diff( get_the_time( ‘U’ ), current_time( ‘timestamp’ ) ) . ‘ ago’; human_time_diff() is the one doing the part regarding your topic. Though … Read more

Changing default WP-Site creation date

There is no blog creation date in WordPress. The first blog post is usually regarded as the blog creation date when you create copyright footer notes for a blog. This is not very reliable though. There are a few thing that happens by default when WordPress is first installed, the most important being a user … Read more

Sort a custom post with ACF: Date Picker & Display Featured!

Please change your args like this. $meta_query = array( array( ‘key’ => ‘event_type’, ‘value’ => ‘featured’, ‘compare’ => ‘=’ ) ); $args = array( ‘post_type’ => ‘event’, ‘posts_per_page’ => -1, ‘order’ => ‘DESC’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘event_date’, ‘meta_query’ => $meta_query );

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

How to amend time format of comments, using child-theme?

You have to return the formatted date string, the following will work: // define the get_comment_time callback function filter_get_comment_time( $date, $d, $gmt, $translate, $comment ) { $d = “g:i:s”; $date = mysql2date($d, $date, $translate); return $date; }; // add the filter add_filter( ‘get_comment_time’, ‘filter_get_comment_time’, 10, 5);

3 different times on my WordPress website

In short, the server shows 13h (correct in current time in São Paulo DST), but PHP shows15h and WordPress shows 12h. This is intentional, and needs additional clarification, but to expand you have: The server local time UTC timestamps Localised WP time These needs to be separate, e.g. if I host a Japanese website on … Read more