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


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(
                   'key' => 'date',
                    'value' => array($beginning_of_day, $end_of_day),
                    'compare' => 'BETWEEN',
      $final_query = new WP_Query();
  • The best I can do is point you to this there is a section on querying by repeater sub fields

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

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.