Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created September 26, 2014 13:05
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 mgibbs189/9ff66c05cc9c60a235a3 to your computer and use it in GitHub Desktop.
Save mgibbs189/9ff66c05cc9c60a235a3 to your computer and use it in GitHub Desktop.
FacetWP + Co-Authors Plus
<?php
$args = array(
'posts_per_page' => -1,
'post_type' => 'bookshelf',
'post_status' => 'publish',
'tax_query' => array( // Query on the "Co-Authors Plus" custom taxonomy
array(
'taxonomy' => 'author',
'terms' => $author // the author ID
)
)
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
echo '<div class="masonry-item"><h2>Bookshelf</h2>';
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>';
echo '<a href="'.get_permalink().'">'.get_the_title().'</a>';
echo '</li>';
}
echo '</ul></div>';
}
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment