Calculate diff among start and end date
Calculate diff among start and end date
// Add Shortcode function days_diff_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_diff', 'days_diff_shortcode' );