Skip to content

Instantly share code, notes, and snippets.

@sarah-hunter
Created July 20, 2015 17:46
Show Gist options
  • Save sarah-hunter/c674779db2b5e639aac1 to your computer and use it in GitHub Desktop.
Save sarah-hunter/c674779db2b5e639aac1 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: Lessons
*
* @package ecokids_theme
*/
get_header(); ?>
<div class="contentContainer clearfix">
<div class="lessons-header section-header clearfix">
<h2>Lesson Plans</h2>
</div>
<div id="content" role="main" class="featured-lessons clearfix">
<h3>Featured Lessons</h3>
<?php $featured_lesson = new WP_Query('post_type=featured_lesson'); ?>
<?php if ( $featured_lesson->have_posts() ) while($featured_lesson->have_posts()) : $featured_lesson->the_post(); ?>
<div class="featured-lesson">
<?php
$image = get_field('featured_image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['sizes']['large_square']; ?>" />
<?php endif; ?>
<div class="lesson-text">
<h5><?php the_title(); ?></h5>
<p class="lesson-subject"><?php $terms = get_the_terms( $post->ID, 'subject' );
foreach ( $terms as $term ) { echo '<span class="each-tag">'; echo $term->name; echo '</span>'; }?></p>
<p class="lesson-grade"><?php $terms = get_the_terms( $post->ID, 'grade' );
foreach ( $terms as $term ) { echo '<span class="each-tag">'; echo $term->name; echo '</span>'; }?></p>
<p class="lesson-theme"><?php $terms = get_the_terms( $post->ID, 'theme' );
foreach ( $terms as $term ) { echo '<span class="each-tag">'; echo $term->name; echo '</span>'; }?></p>
<p class="download-link"><a href="<?php the_field('lesson_plan'); ?>" target="_blank"><i class="fa fa-arrow-down fa-lg"></i></a></p>
</div>
</div>
<?php endwhile; ?>
<section class="lessons-section clearfix">
<h3>Search Lessons</h3>
<p><?php the_content(); ?></p>
<div class="search-box">
<?php echo facetwp_display( 'facet', 'subject' ); ?>
<?php echo facetwp_display( 'facet', 'grade' ); ?>
<?php echo facetwp_display( 'facet', 'theme'); ?>
<?php echo facetwp_display( 'facet', 'language' ); ?>
<div style="display:none"><?php echo facetwp_display( 'template', 'searchlessons' ); ?></div>
</div>
<?php wp_reset_query(); ?>
<div class="search-results facetwp-template">
<?php while(have_posts()) : the_post(); ?>
<?php the_field('lesson_plan') ?>
<?php endwhile; ?>
</div>
</div><!-- #content -->
</section>
</div><!-- / .contentContainer -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment