Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Template Name: Lessons
*
* @package ecokids_theme
*/
get_header(); ?>
@sarah-hunter
sarah-hunter / gist:5d8c7dcb3f6fc7336093
Created July 20, 2015 18:37
Display Code for FacetWP
<?php while ( have_posts() ) : the_post(); ?>
<div class="single-lesson">
<h5><?php the_title(); ?></h5>
<p class="lesson-grade"><?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>
<?php while ( have_posts() ) : the_post(); ?>
<div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
<?php endwhile; ?>
<?php
return array(
'post_type' => 'any',
'posts_per_page' => 15,
);
<?php while ( have_posts() ) : the_post(); ?>
<div class="single-lesson">
<h5><?php the_title(); ?></h5>
<p class="lesson-grade"><?php $terms = get_the_terms( $post->ID, 'subject' );
if ( $terms ) { 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' );
if ( $terms ) { 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' );
if ( $terms ) { foreach ( $terms as $term ) { echo '<span class="each-tag">'; echo $term->name; echo '</span>'; } } ?></p>