I’ve created a custom post type called “References” and a custom taxonomy “Genre”.
I have 2 terms : Applications and Games.
My problem is that I’d like to show posts associated in Applications on a page (and the same for the games). I believe WordPress do this like doing the same for tags….
In fact, I just need to make a query and getting the current term of the page.
Here is what I tried but I get the same list for each terms page (Applications and Games) :
<?php get_header(); ?>
<div class="container" role="main">
<h1 class="entry-title"><?php single_cat_title(); ?></h1>
<div class="entry-content ref">
<?php
$loop = new WP_Query( array( 'post_type' => 'references' , 'genre' => '') ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><?php the_title(); ?></h2>
<div class="ref"><?php the_content(); ?></div>
</div><!-- #post-## -->
<?php the_post_thumbnail();?>
<?php endwhile; // end of the loop. ?>
</div><!-- .entry-content -->
</div><!-- #container -->
<?php get_footer(); ?>
Hope someone can help me. I’ve Googled for a week now…
try this:
And you should put this in your theme inside taxonomy-genre.php