Days
Calculate diff among sart and end
// Add Shortcode
function days_shortcode( $atts ) {
// Attributes
extract( shortcode_atts(
array(
'start' => 'now',
'end' => 'now',
), $atts )
);
// Code
$init = new DateTime($start);
$finit = new DateTime($end);
$interval = $init -> diff($finit);
return $interval -> format('%a');
}
add_shortcode( 'days', 'days_shortcode' );