Tag Info

New answers tagged

0

OK, I found the answer myself. Turns out that in Wordpress the UTC time is hardcoded and thus using PHP's date() will always return UTC. Instead you should use WP's function current_time(). Here are more details


0

If you haven't already done so, install the ntp package on your web server(s), it automatically syncs the time for you against multiple reference time servers (atomic clocks). Otherwise server clocks do tend to drift over time. Crucially, ntp also makes any adjustments gradually (in steps), so as to minimise the chance of confusing any automated processes ...


1

WordPress essentially completely ignores native PHP date functionality, in favor of its own handling. That traditionally allowed it to manage related aspects (such as timezones and translation) with no regards for server configuration. My educated guess that it would be largely oblivious to such change. At most the cron tasks might fire in bulk and some ...


2

Before Wordpress 4.1, you can show the date archive page titles with the following code: (Taken and slightly modified from the twentyfourteen theme) if ( is_day() ) { printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() ); } elseif ( is_month() ) { printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', ...


2

The correct core function should be current_time() Untested, but your code ought to look something like: if (current_time('H') >= 8 && current_time('H') < 20)


2

I believe you're using the wrong function. get_the_time() doesn't actually return the current time but instead the time of when the post was published. Maybe what you're looking to use is date( 'H' ).


0

You can also use ',' instead of '.' for concatenating strings in echo funcion. echo 'Archive for ' , the_time('Y');



Top 50 recent answers are included