How to change post date only 1 time a day?

Compare the post_date with the current time and then test if the difference is greater than one day: is_admin() or add_action( ‘the_post’, function( $post ) { if ( ! is_singular() or ! is_main_query() ) return; // now minus last mod time in seconds $diff = time() – mysql2date( ‘U’, $post->post_date ); if ( DAY_IN_SECONDS >= … Read more

Auto update date time 1 times per day?

You’re looking for wp_cron if ( ! wp_next_scheduled( ‘my_task_hook’ ) ) { wp_schedule_event( time(), ‘daily’, ‘my_task_hook’ ); } add_action( ‘my_task_hook’, ‘my_task_function’ ); And then you define my_task_function() updating the post date.

Swatch Internet Time for article timestamps

You can use ‘B’ as the format for the_date() and/or the_time() to generate Swatch Internet Time format. If you’re modifying a theme, just find the references to the_date() and/or the_time() in the template files and change the value of the format parameter. If you’re creating a plugin, you can hook into the get_the_date and/or get_the_time … Read more

Modify human_time_diff() to shorten “days” to “d” and “hours” to “h” etc

There is no filter for output of that function. You can fork (copy/rename/edit) it or add wrapper that will replace strings in output like this: function short_time_diff( $from, $to = ” ) { $diff = human_time_diff($from,$to); $replace = array( ‘hour’ => ‘h’, ‘hours’ => ‘h’, ‘day’ => ‘d’, ‘days’ => ‘d’, ); return strtr($diff,$replace); } … Read more