我正在尝试制作一个显示自定义类别列表的插件,我正在使用
function page_template( $template )
{
if ( get_post_type( get_the_ID() ) == 'gallery' ) {
$template = plugin_dir_path(__FILE__) . '/custom-page-template.php';
}
return $template;
}
add_filter( 'template_include', 'page_template' );
and is working good, now i get the url from each category using
<?php
$value = term_exists( 'category', 'taxonomy' ); // array is returned if taxonomy is given
if(isset($value)){?>
<a href="<?php echo get_term_link( 'category', taxonomy ) ?>" > Blepharoplasty</a>
<?php } ?>
而且工作得很好。现在我需要知道当我单击通过 get_term_link() 获得的 url 时如何添加新模板。
谢谢