Skip to content

Instantly share code, notes, and snippets.

@macgraphic
Created December 6, 2019 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macgraphic/6cba96f53861704b03a6ef468e9b4b03 to your computer and use it in GitHub Desktop.
Save macgraphic/6cba96f53861704b03a6ef468e9b4b03 to your computer and use it in GitHub Desktop.
<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package LLNI
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
$args = array(
'page_id' => '2630',
);
$introquery = new WP_Query( $args );
if ( $introquery->have_posts() ) {
while ( $introquery->have_posts() ) {
$introquery->the_post();
the_content();
}
}
wp_reset_postdata();
?>
<div class="eventGrid grid-x grid-margin-x grid-margin-y">
<?php
if ( have_posts() ) :
?>
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$date = get_field( 'event_date' );
$time = get_field( 'start_time' );
$post = get_post();
$query = new WP_Query( array(
'post_type' => 'events',
'event_category' => 'upcoming-events',
'meta_key' => array( $date ),
'orderby' => 'meta_value',
'order' => 'ASC',
'paged' => $paged,
),
);
while ( $query->have_posts() ) : $query->the_post();
?>
<div class="eventBlock card cell small-12 medium-6 large-4">
<div class="eventImage cell">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>">
<img role="img" src="<?php the_post_thumbnail_url( 'blog-big' ); ?>" alt="<?php the_title(); ?>"/>
</a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php bloginfo( 'template_directory' ); ?>/assets/images/default.png" alt="<?php echo esc_attr( the_title() ); ?>, <?php the_field( 'role' ); ?>" />
</a>
<?php } ?>
</div>
<div class="eventText">
<a href="<?php the_permalink(); ?>">
<h5><?php the_title(); ?></h5>
</a>
<h2><?php the_field( 'event_date' ); ?></h2>
<div class="dateTime grid-x text-center">
<div class="dateTimeDate cell small-6 align-self-middle">
<p>
<?php svg_icon( 'calendar' ); ?>
<?php echo esc_attr( $date ); ?>
</p>
</div>
<div class="dateTimeTime cell small-6 align-self-middle">
<p>
<?php svg_icon( 'clock' ); ?>
<?php echo esc_attr( $time ); ?>
</p>
</div>
</div>
<div class="eventExcerpt">
<?php the_excerpt(); ?>
</div>
</div> <!-- .eventText -->
</div> <!-- .eventBlock -->
<?php endwhile; ?>
<div class="pageNav grid-x grid-padding-x grid-padding-y">
<div class="cell clearfix">
<?php page_navi(); ?>
</div>
</div>
<?php endif; ?>
</div> <!-- .grid-x -->
</div> <!-- .eventList -->
<?php
// wp_reset_query();
wp_reset_postdata();
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment