Home › Forums › Front-end Issues › Widget Calendar and Date field › Reply To: Widget Calendar and Date field
Ok thanks i understand, so i’ve used a wp calendar widget clone(https://pippinsplugins.com/custom-post-type-calendar-widget/) and i think
instead of using :
// Get days with posts
$dayswithposts = $wpdb->get_results( "SELECT DISTINCT DAYOFMONTH( post_date )
FROM $wpdb->posts WHERE MONTH( date ) = '$thismonth'
AND YEAR( post_date ) = '$thisyear'
AND post_type IN ( $post_types ) AND post_status = 'publish '"
, ARRAY_N );
i suppose i musts do something like :
$args = array (
'post_type' => 'post', // your custom post type
'meta_key' => 'date_de_la_manifestation', // your custom date field name
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'date_de_la_manifestation',
'compare' => 'REGEXP',
'value' => '[0-9]{4}' . $thismonth . '[0-9]{2}',
),
)
);
and after make a loop on result to get the day of my acf field date_de_la_manifestation and displays it in the calendar.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.