is_404

Definition:
function is_404() {}

Is the query a 404 (returns no results)?

Source code

	function is_404() {

		return (bool) $this->is_404;

	}

2079

iso8601_to_datetime

Definition:
function iso8601_to_datetime($date_string, $timezone = 'user') {}

Converts an iso8601 date to MySQL DateTime format used by post_date[_gmt].

Parameters

  • string $date_string: Date and time in ISO 8601 format http://en.wikipedia.org/wiki/ISO_8601.
  • string $timezone: Optional. If set to GMT returns the time minus gmt_offset. Default is ‘user’.

Return values

returns:The date and time in MySQL DateTime format – Y-m-d H:i:s.

Source code

function iso8601_to_datetime($date_string, $timezone = 'user') {

	$timezone = strtolower($timezone);



	if ($timezone == 'gmt') {



		preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);



		if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset

			$offset = iso8601_timezone_to_offset($date_bits[7]);

		} else { // we don't have a timezone, so we assume user local timezone (not server's!)

			$offset = 3600 * get_option('gmt_offset');

		}



		$timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);

		$timestamp -= $offset;



		return gmdate('Y-m-d H:i:s', $timestamp);



	} else if ($timezone == 'user') {

		return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);

	}

}

2077

iso8601_timezone_to_offset

Definition:
function iso8601_timezone_to_offset($timezone) {}

Computes an offset in seconds from an iso8601 timezone.

Parameters

  • string $timezone: Either ‘Z’ for 0 offset or ‘±hhmm’.

Return values

returns:The offset in seconds.

Source code

function iso8601_timezone_to_offset($timezone) {

	// $timezone is either 'Z' or '[+|-]hhmm'

	if ($timezone == 'Z') {

		$offset = 0;

	} else {

		$sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1;

		$hours   = intval(substr($timezone, 1, 2));

		$minutes = intval(substr($timezone, 3, 4)) / 60;

		$offset  = $sign * 3600 * ($hours + $minutes);

	}

	return $offset;

}

2075

in_the_loop

Definition:
function in_the_loop() {}

Whether the caller is in the Loop.

Return values

returns:True if caller is within loop, false if loop hasn’t started or ended.

Source code

function in_the_loop() {

	global $wp_query;



	return $wp_query->in_the_loop;

}

2073

in_category

Definition:
function in_category( $category, $post = null ) {}

Check if the current post in within any of the given categories.
The given categories are checked against the post’s categories’ term_ids, names and slugs. Categories given as integers will only be checked against the post’s categories’ term_ids.

Parameters

  • int|string|array $category: Category ID, name or slug, or array of said.
  • int|object $_post: Optional. Post to check instead of the current post. (since 2.7.0)
  • $post

Return values

returns:True if the current post is in any of the given categories.

Source code

function in_category( $category, $post = null ) {

	if ( empty( $category ) )

		return false;



	return has_term( $category, 'category', $post );

}

2071