Support

Account

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.