Checking if post is archive
-
Hey,
So this is what I am creating right now:
https://www.dimsur.org/events-page
I am trying to split the upcoming and archive events with tabs.
I am working on shortcode-event-list.php and so far I have this:
global $eo_event_loop,$eo_event_loop_args; //Date % Time format for events $date_format = get_option('date_format'); $time_format = get_option('time_format'); //The list ID / classes $id = ( $eo_event_loop_args['id'] ? 'id="'.$eo_event_loop_args['id'].'"' : '' ); $classes = $eo_event_loop_args['class']; ?> <?php if( $eo_event_loop->have_posts() ): ?> <div id="tabs" class="schedule-tabs-wrapper"> <ul role="tablist"> <li><a href="#schedule-upcoming">Upcoming</a></li> <li><a href="#schedule-archived">Archived</a></li> </ul> <div id="schedule-upcoming" class="schedule-tabs-content"> <table <?php echo $id; ?> class="<?php echo esc_attr($classes);?> schedule-table" > <tbody> <tr class="table-title"> <th class="header-date">Date</th> <th class="header-title">Course Title</th> <th class="header-venues">Venues</th> </tr> <?php while( $eo_event_loop->have_posts() ): $eo_event_loop->the_post(); ?> <?php //Generate HTML classes for this event $eo_event_classes = eo_get_event_classes(); //For non-all-day events, include time formata $format = ( eo_is_all_day() ? $date_format : $date_format.' '.$time_format ); ?> <tr class="schedule-row"> <td class="cell-date"> <span class="event-date-block"> <span class="event-date-top"><?php echo eo_get_the_start('j'); ?></span><span class="event-date-bottom"><?php echo eo_get_the_start('M'); ?></span> </span> <span class="event-date-block"> <span class="event-date-top">-</span><span class="event-date-bottom"> </span> </span> <span class="event-date-block"> <span class="event-date-top"><?php echo eo_get_the_end('j'); ?></span><span class="event-date-bottom"><?php echo eo_get_the_end('M'); ?></span> </span> </td> <td class="cell-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_title(); ?></a></td> <td class="cell-venues"><?php echo eo_get_venue_name(); ?> </td> </tr> <?php endwhile; ?> </tbody> </table> </div> <div id="schedule-archived" class="schedule-tabs-content"> <!-- // Archive // Events // How // To // Retrieve --> </div> </div> <?php elseif( ! empty($eo_event_loop_args['no_events']) ): ?> <ul id="<?php echo esc_attr($id);?>" class="<?php echo esc_attr($classes);?>" > <li class="eo-no-events" > <?php echo $eo_event_loop_args['no_events']; ?> </li> </ul> <?php endif; ?>
I am trying to figure out, how I can check if this loop has archive posts. Should I create a new loop or use the $eo_event_loop and check if posts are archived? I’m not sure how to do it.
Can you help me?
Thanks in advance,
Tom
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Checking if post is archive’ is closed to new replies.