Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Display Posts of a Custom Post Type Taxonomy

$
0
0

Hello, I've created a new page template and would like to display a list of custom posts with a particular custom taxonomy. Nothing is coming up and no debug errors are showing up.

<?php

$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'funds',
'field' => 'slug',
'terms' => 'all-funds'
)
)
);
$query = new WP_Query( $args );

// The Query
$the_query = new WP_Query( $args );

// The Loop
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();?>


Viewing all articles
Browse latest Browse all 20145

Trending Articles