I have 2 custom field: "start-date" and "end-date".
If the administrator don't set the "end-date" field, i want to set dynamicly the end-date with the start-date.
Is it possible ?
I use ACF for my field, but if necessary, I can export my fields in php: to add to the file functions.php
I use the meta_key for the query.
Initially I was using "start-date" to sort my event. But when an event is on a couple of days it dissparaissait after the 2nd day.
So now I use "end-date", but the events of a single day does not have a "end-date" defined.
For information, if I defined a "end-date" for my event on a single day: It Works. But I would simplify the publication of an event, if the event is one day not need to set the end date (since it's the same as the start date)
my code:
$args = array(
'post_type'=>'evenement','meta_key'=>'end-date','orderby'=>'meta_value_num' , 'order'=>'ASC' , 'posts_per_page'=> 3,
'meta_query'=> array (array('key' => 'end-date', 'compare' => '>=', 'value' => $current_date, 'type' => 'numeric',))
);
query_posts( $args );
I speak very little English sorry if I'm not understandable
Maybe the problem can be solved if the fields are filled at the time of publication of the post. Is it possible to set the default value of the "end-date" field with the "start-date" fields