Skip to content

Instantly share code, notes, and snippets.

@JeremyEnglert
Created August 30, 2016 21:53
Show Gist options
  • Save JeremyEnglert/fff22ac07110734cb4c46699556270ca to your computer and use it in GitHub Desktop.
Save JeremyEnglert/fff22ac07110734cb4c46699556270ca to your computer and use it in GitHub Desktop.
<aside id="sidebar" class="left-sidebar small-16 large-3 columns large-pull-13">
<h1>NewsCheck Archive</h1>
<?php do_action('foundationpress_before_sidebar'); ?>
<?php
$single_post_id = get_the_ID();
$terms = get_the_terms($single_post_id, 'aps_page_group');
$args = array(
'post_type' => 'page',
'posts_per_page' => -1,
'order' => 'DESC',
'orderby' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'aps_page_group',
'field' => 'slug',
'terms' => $term->slug,
),
),
);
$section_sidebar_query = new WP_Query( $args );
if ( $section_sidebar_query->have_posts() ) : ?>
<?php while ( $section_sidebar_query->have_posts() ) : $section_sidebar_query->the_post(); ?>
<!-- Test markup to test query -->
<h2><?php the_title(); ?></h2>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</aside>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment