Support

Account

Home Forums Front-end Issues WordPress Loop and Date Picker Problem

Helping

WordPress Loop and Date Picker Problem

  • Hello to all,

    I have created a custom post type in which I enter holidays and days that repeat every year.

    To enter the date I have taken the ACF Datepicker.

    This saves the date format in the database but always in the format: “YYYYMMDD”.

    The entered days are displayed in two loops in the template. One which shows the future days from today. And once the days, which are past and come only in the next year again.

    $args_future = array(
                'post_type' => 'repeat-days',
                'meta_key' => 'repeat_day_date',
                'posts_per_page' => -1,
                'orderby' => 'meta_value',
                'order' => 'ASC',
                'meta_query' => array(
                    array(
                        'key' => 'repeat_day_date', // ACF Feld Name
                        'compare' => '>=',
                        'value' => date("Y-m-d"),
                        'type' => 'DATE'
                    )
                ),
            );

    For the output, however, the year is uninteresting for me.

    Can I somehow tell the wordpress loop that it should only take into account the months and days?

  • I have now solved it with a normal number field by taking the date syntax as follows: “MMDD”.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.