0

I have a custom taxonomy 'where' and I am using this code to get taxonomy terms on single.php

<?php echo get_the_term_list( $post->ID, 'where', 'Where: ', ', ', '' ); ?>

How can I customize this code in a way if user click on 'where' terms, they should get posts of this taxonomy only from the current category.

0

Use a taxonomy.php template?!

taxonomy.php

<?php get_header(); ?>

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

<h1><?php echo $term->name; ?></h1>

<?php
global $query_string;
query_posts( $query_string . '&orderby=title&order=asc' );

if (have_posts()) : 
?>

<?php
while (have_posts()) : the_post();
?>

<h1><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>

<?php endwhile; 
wp_reset_query();
?>

<?php endif; ?>

<?php get_footer(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.