Support

Account

Home Forums Add-ons Repeater Field echo key + meta_key (date/time picker) from repeater field

Unread

echo key + meta_key (date/time picker) from repeater field

  • Okay,
    so basically I created a wordpress calendar, my events are custom post_types.
    Those custom post_types do have a repeater field with date/time picker.
    Now, those events do repeat, that’s why the repeater field, it’s even possible it repeats 2x a day just at a different time.
    I’d like to echo the date + time of each loop.

    This is my code so far:


    for ($d = 0; $d < 6; $d++) {
    $weekday_ts = strtotime(‘tuesday +’ . $d . ‘ day this week ‘ . date(‘Y-m-d H:i’, $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_preview’,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘event_start_date_repeater_$’,
    ‘meta_key’ => ‘event_start_date’,
    ‘value’ => array($beginning_of_day, $end_of_day),
    ‘compare’ => ‘BETWEEN’,
    ),

    )
    ));
    $final_query = new WP_Query();
    $final_query->posts = $loop_news->posts;
    // Recount
    $final_query->post_count = count($final_query->posts);
    $post_count = $final_query->post_count;

    // Convert number into letters
    if ($post_count > 0) {
    $f = new NumberFormatter(“en”, NumberFormatter::SPELLOUT);
    $num_events = $f->format($post_count) . ‘Event’;
    } else {
    $num_events = ”;
    }
    // Current Event Class
    if ($today_ts == $weekday_ts) {
    $current_class = ‘ current’;
    } else {
    $current_class = ”;
    }
    echo ‘<div class=”row”><td class=”‘ . $num_events . ‘ d’ . $day_of_the_year . ‘ ‘ . $current_class . ‘”>’;
    if ($post_count > 0) {
    if ($final_query->have_posts()) :
    while ($final_query->have_posts()) : $final_query->the_post();
    ?>
    <div class=”Title”>
    “>
    <?php the_title(); ?>

    </div>
    <div class=”Details”>

    • <?php the_field(‘details_1’); ?>
    • <?php the_field(‘details_2’); ?>

    </div>
    <?php
    endwhile;
    endif;
    wp_reset_query();
    wp_reset_postdata();
    }
    echo ‘</td></div>’;
    } // end of daily Events

    my Events show on the correct date but how do I echo now this date/time within the repeater field?
    I am kind of lost.

Viewing 1 post (of 1 total)

The topic ‘echo key + meta_key (date/time picker) from repeater field’ is closed to new replies.