Tell us what you are trying to do?
Display start date if one-day event and more if additional days scheduled. Basically I only need start date if not more than one day but would like additional of more than one - i.e. Jan 1 (one day only) OR Jan 1 to Jan 3 (3-day event)
Is there a similar example that we can see?
[wpv-conditional if="( $(wpcf-start-date) eq '$(wpcf-end-date)' )"][types field="start_date"][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-start-date) ne '$(wpcf-end-date)' )"] to [types field="end_date"][/types] [/wpv-conditional]
Hello,
It needs custom codes, for example:
1) Add below PHP codes into your theme file "functions.php":
add_shortcode('days', function($atts, $content){
$start_date = get_post_meta(get_the_ID(), 'wpcf-start-date', true);
$end_date = get_post_meta(get_the_ID(), 'wpcf-end-date', true);
$res = ($end_date - $start_date) / (3600 * 24);
return round($res);
});
2) Use above custom shortcode like this:
[wpv-conditional if="( $(wpcf-start-date) eq '$(wpcf-end-date)' )"][types field="start-date"][/types](One day event)[/wpv-conditional]
[wpv-conditional if="( $(wpcf-start-date) ne '$(wpcf-end-date)' )"][types field="start-date"][/types] to [types field="end-date"][/types]([days] days event)[/wpv-conditional]
Please replace "start-date" and "end-date" with your custom date field slugs.