Support

Account

Home Forums General Issues Display post in date field select Reply To: Display post in date field select

  • Hi @serviceweb

    Yes, you can do it. First, you need to get the current day by using the date() function. After that, you need to query the posts based on the current day. It should be something like this:

    $today = date('Ymd');
    
    $the_posts = get_posts(array(
        'numberposts'    => -1,
        'post_type'      => 'post',
        'meta_query'     => array(
            array(
                'key'         => 'date_picker_field_name',
                'value'          => $today,
            ),
        ),
    ));
    print_r($the_posts);

    Don’t forget to change the “date_picker_field_name” text with your date picker field name. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/query-posts-custom-fields/.

    Also, please keep in mind that there are differences between date picker field in PRO and free version. To learn more about it, kindly check this page: https://www.advancedcustomfields.com/resources/date-picker/.

    I hope this helps 🙂