Skip to content

Instantly share code, notes, and snippets.

@robin-scott
Created December 1, 2017 13:10
Show Gist options
  • Save robin-scott/c454a8030ec3862978fd1638a12e73a5 to your computer and use it in GitHub Desktop.
Save robin-scott/c454a8030ec3862978fd1638a12e73a5 to your computer and use it in GitHub Desktop.
Shows the current time in London, when a shortcode is called in WordPress
// Add a shortcode to dispay [now_time] for the time in Europe/London - by Robin Scott of Silicon Dales
function sd_now_time_formated($atts) {
date_default_timezone_set("Europe/London");
$i = date('g:i A');
return $i;
}
add_shortcode('now_time', 'sd_now_time_formated');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment