-
Notifications
You must be signed in to change notification settings - Fork 7
Internal Shortcode | [Post_Date_GMT]
EkoJr edited this page Mar 16, 2017
·
4 revisions
Adds the post/page date & time as GMT timezone.
[post_date_gmt format="m-d-Y"]
(string) (optional) Format used via PHP. Default: "m-d-Y"
(string) WP_Post Post_Date_GMT.
[post_date_gmt format="m-d-Y"]
Returns
9-27-2016
File: advanced-post-list/includes/class/apl_shortcodes.php
/**
* Post Date GMT Shortcode.
*
* Desc: Adds the post/page date.
*
* 1. Get & Add to return Post's Formatted GMT Date.
* 2. Return string.
*
* @since 0.1.0
* @version 0.4.0 - Changed to Class function, and uses WP's built-in
* functions for setting default attributes & do_shortcode().
*
* @link http://php.net/manual/en/function.date.php
*
* @param array $atts {
*
* Shortcode Attributes.
*
* @type string $format Used to format date via PHP function.
*
* }
* @return string Post Date GMT.
*/
public function post_date_gmt($atts)
{
//INIT
$atts_value = shortcode_atts( array(
'format' => 'm-d-Y'
), $atts, 'post_date');
$return_str = '';
//STEP 1
$return_str .= mysql2date($atts_value['format'], $this->_post->post_date_gmt);
//STEP 2
return $return_str;
}
- Format for PHP Date/Time Function - Describes the format used in APL.
- [post_date] - WP_Post Date/Time.
- [post_modified] - WP_Post Modified Date/Time.
- [post_modified_gmt] - WP_Post Modified Date/Time GMT.