Created
February 7, 2016 07:19
-
-
Save hsleonis/dfd62a7e81ce9f54db31 to your computer and use it in GitHub Desktop.
Custom Taxonomy not showing posts solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Even though it's tied to the custom post, | |
it still assumes you want to query normal post so I added this to my template and it works: | |
*/ | |
global $wp_query; | |
$args = array_merge( $wp_query->query, array( 'post_type' => 'portfolio' ) ); | |
$post = query_posts( $args ); // All posts in query | |
echo count($post); // Count total posts in query | |
echo get_query_var('term'); // Print taxonomy | |
while(have_posts()): the_post(); // The loop | |
the_permalink(); | |
the_post_thumbnail_url(); | |
the_title(); | |
endwhile; | |
wp_reset_query(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment