How can i format a date coming from a 3rd party (toolset) custom field?

I am calling a third party custom field in the custom post layout editor

[wpbb post:custom_field key=‘wpcf-event-start-date’]

However the format it outputs the custom field is just a raw date. How can I format the output of this custom field to be more pleasing? Add format=‘F j, Y’ doesn’t work.

That will not work because the custom_field shortcode literally just outputs the contents of the field, it could be anything, text, numbers, a url or an image, anything.

So you need to write your own shortcode for wordpress. Twenty odd years of documentation on the internet for add_shortcode :slight_smile: Heres an example:

add_shortcode( 'custom-date', function( $atts ) {
	$atts = shortcode_atts(
		array(
			'field'   => 'wpcf-event-start-date',
			'post_id' => get_the_ID(),
			'format'  => 'F j,Y',
		), $atts
	);

	$field = get_post_meta( $atts['post_id'], $atts['field'], true );
	return gmdate( $atts['format'], strtotime( $field ) );
});