Skip Navigation

Date formating on another CPT's date field

This support ticket is created 7 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Steve 7 years, 9 months ago.

Assigned support staff: Luo Yang.


I am trying to Format a date field from "the event calendar" in a content template. I ve used the shortcode like this to display and format the date but get the full time stamp. Not what I want

[wpv-post-field name="_EventStartDate" format="M. j"]

Am i doing this correctly?


Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I assume we are talking about the plugin download from:

It is storing string value into custom field _EventStartDate, so the format parameter won't work in this case, I suggest you try create another shortcode for it, like this:
1) add codes in your theme/functions.php:

add_shortcode('string2date', 'string2date_func');
function string2date_func($atts, $content){
	$atts = shortcode_atts( array(
		'slug' => '_EventStartDate',
		'format' => 'M. j',
	), $atts);
	$res = '';
		$str = get_post_meta(get_the_ID(), $atts['slug'], true);
		$time_stamp = strtotime($str);
		$res = date($atts['format'], $time_stamp);
	return $res;

2) use above shortcode in your content like this:
[string2date slug="_EventStartDate" format="M. j"]


Luoy thanks so much -perfect.