Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Created February 7, 2016 07:19
Show Gist options
  • Save hsleonis/dfd62a7e81ce9f54db31 to your computer and use it in GitHub Desktop.
Save hsleonis/dfd62a7e81ce9f54db31 to your computer and use it in GitHub Desktop.
Custom Taxonomy not showing posts solution
<?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