Timezones and timestamp SQL to PHP

Dealing with godaddy mySQL timestamps on a shared server. As of this posting, although Arizona is in the Mountain time zone, it does not participate in the Daylight Savings party. Issue is that godaddy timstamps are “readable” but are in US/Arizona timezone. If the server is on a shared host, the default timezone can NOT be changed.

Here is my solution to the problem of querying a godaddy sql server timestamp:

  1. In your PHP script include the line (add your desired time zone as needed):
  2. In the $sql “SELECT….” statement, use the following:
  3. To display the time in a readable format use “date(‘format’,timestamp)” formula:
    echo date(‘D, M j – g:ia’,timestamp);

Why use “if (!function_exists(‘…”

Checking to see if built in WordPress functions exist before calling them is for backward compatibility which IMHO is not needed.

So if you see if ( function_exists( 'register_nav_menus' ) ) the theme author is supporting versions earlier than 3.0.

You still sometimes see
 if ( function_exists( 'dynamic_sidebar' ) ) 
Why? I couldn’t tell you because dynamic_sidebar was introduced in 2.2.

Another reason to use it is to make your theme or plugin pluggable. A pluggable function is one that can be overridden in a child theme or another plugin.

This is done on the definition not the call and you use the ! operator to make sure it doesn’t already exist before you define it.

if ( ! function_exists( 'my_awesome_function' ) ) {
 * My Awesome function is awesome
 * @param array $args
 * @return array
function my_awesome_function( $args ) {
  //function stuff
  return array();

When this is done a child theme or other plugin can override that function with there own.

source: https://wordpress.stackexchange.com/a/111318