你猜吧,首先你需要你要去哪里打电话给你的条件页面模板,但你需要他分类打电话吧?要做到这一点,你需要使用的功能get_terms($taxonomies, $args);
,并与功能get_term_link($term)
,你要获得当期的网址:
$args = array('hide_empty=0');
$terms = get_terms('my_term', $args);
if (! empty($terms) && ! is_wp_error($terms)) {
$count = count($terms);
$i = 0;
$term_list = '<p class="my_term-archive">';
foreach ($terms as $term) {
$i++;
$term_list .= '<a href="' . get_term_link($term) . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a>';
if ($count != $i) {
$term_list .= ' · ';
}
else {
$term_list .= '</p>';
}
}
echo $term_list;
}
然后,你需要你要去哪里,显示了关联到当前所有职位archive.php术语。
但首先您需要获取当前的术语,并且可以使用功能get_term_by($field, $value, $taxonomy, $output, $filter)
来完成。
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
现在你可以让一个if语句:
if($term = 'red'){
the_title();
//Or get_template_part('content', 'stories');
}else{
//...
}
我得到它的工作的感谢您的咨询。非常感谢。 – lowercase