按当前类别列出的文件管理器分类帖子

时间:2012-11-17 作者:Allen

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.

1 个回复
SO网友:r1987

使用taxonomy.php 样板

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(); ?>

结束

相关推荐