Custom function to return date without time

[ad_1]

Also is there a way to make it work with multiple different pods, not just ‘rebate_applications’?

Thanks!

I’m going to sleep at the moment so sorry if this is too short, but the date time string can be parsed to a date integer with https://www.php.net/manual/en/function.strtotime.php then parsed back to a string with https://www.php.net/manual/en/function.date.php

You can get the post type from the post ID with

@reedus33

<?php

add_shortcode(
	'date_only',
	function( $atts, $content, $shortcode_tag ) {
		return return_date_only( get_the_ID() );
	}
);

function return_date_only( $id ) {
	$date_time = get_post_meta( $id, 'application_date', true );
	return date(
		'M j, Y',
		strtotime( $date_time )
	);
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer