Calculate how much time passed comparing WordPress comment and current time

Yes, you can do that using PHP. Here’s a function from @arnorhs: $time = strtotime(‘2010-04-28 17:25:43’); echo ‘event happened ‘.humanTiming($time).’ ago’; function humanTiming ($time) { $time = time() – $time; // to get the time since that moment $time = ($time<1)? 1 : $time; $tokens = array ( 31536000 => ‘year’, 2592000 => ‘month’, 604800 … Read more

Display datetime in user’s timezone

You could use a service like Google Timezone you could get the users lat/lng data using geolocation then store that in a transient agains the IP address. Don’t rely on the IP as users on a satellite connection like me can have the location pinged as thousands of km away.

Change the year of the whole site

If you want to do this temporarily that means you want to be able to switch back later, right? That in turn means you don’t want to change the values in the database. So you want the_time to change after it has retrieved the value from the database, but before it is presented to the … Read more

Apply filters on date format

As per the code reference the_time filter recieves two parameters – $get_the_time and $format. You can use the latter to determine which formatting option to use. add_filter( ‘the_time’, ‘changer_date_format’, 10, 2 ); function changer_date_format( $ladate, $format ) { global $post; if ( ‘d M’ === $format ) { return get_post_time( get_option( ‘date_format’ ), false, $post, … Read more

wp_dropdown_categories by date?

I have a fancy function that i made just for that: <?php /* Create taxomony term list of posts based on given year * * @param $year – (int) 4 digits – the year to return the list of. required * * @param $taxonomy – (string) the taxonomy name of which the retreve the terms. … Read more