Support

Account

Home Forums Add-ons Repeater Field meta key from repeater field

Solved

meta key from repeater field

  • Hi,

    I have a custom post_type called ‘event’ which has a repeater field called ‘date’,
    now I am trying to loop them through a calendar which is looping through each day, looking for the dates.

    Now I can easily achieve this with a normal custom field but obviously it will show up only once, how do I loop through with a repeater_field key?

    My code with a normal custom field:

    
    for ($d = 0; $d < 7; $d++) {
    $weekday_ts = strtotime('monday +' . $d . ' day this week ' . date('Y-m-d', $first_day_of_month_ts));
    $day_of_the_year = date("z", $weekday_ts);
    $beginning_of_day = strtotime("midnight", $weekday_ts);
    $end_of_day = strtotime("tomorrow", $beginning_of_day) - 1;
    
    $loop_news = new WP_Query(array(
            'posts_per_page' => -1,
            'post_type' => 'event',
            'meta_query' => array(
               array(
                   'key' => 'date',
                    'value' => array($beginning_of_day, $end_of_day),
                    'compare' => 'BETWEEN',
        ),
     )
     ));
      $final_query = new WP_Query();
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘meta key from repeater field’ is closed to new replies.