} ?> </optgroup> </select> <label>Select with option filtering</label> </div> <?php break; //case of events case '5': ?> <div class="form-group"> <select class="form-control select2-list" data-placeholder="Select an item"> <optgroup label="Active new articles"> <?php foreach(get_active_events() as $row){ ?> <option value="<?=$row['id']?>"><?=$row['title']?></option> <?php } ?> </optgroup> </select> <label>Select with option filtering</label> </div> <?php break; //case of users case '6': ?> <div class="form-group">
<?php //How many events we have? $active_events = get_active_events(); //We need a total of 3, active events get priority. $active_num = $active_events->post_count; ?> <section class="focus" id="focus"> <div class="container"> <div class="row"> <?php while ($active_events->have_posts()) { $active_events->the_post(); $event_id = get_the_ID(); $event_type = get_post_meta($event_id, 'event_type', true); $permalink = get_post_permalink(); $event_date_start = get_post_meta($event_id, 'event_datetime_start', true); $event_date_end = get_post_meta($event_id, 'event_datetime_end', true); $date_formatted = get_single_event_widget_formatted_date($event_date_start, $event_date_end); echo '<div class="col-md-3 col-sm-6 active ' . esc_attr($event_type) . '">'; echo '<div class="square-box">'; echo '<div class="square-content-wrap">'; echo '<a href="' . esc_url($permalink) . '">'; echo '<span class="event-wpap">'; echo '<div class="event-date">' . $date_formatted . '</div>'; echo '<div class="event-img"></div>'; echo '<div class="event-title">' . wp_trim_words(get_the_title($event_id), 4, '') . '</div>'; echo '</span>'; echo '</a>'; echo '</div>';