使用get\\u术语,我创建了三个术语链接列表。如果我单击一个术语,当前会发生什么,就是要查看该术语的存档,而我现在试图实现的是,当我单击第二个术语时,我想查看两个术语的存档,而不仅仅是最新术语的存档。基本上是创建一些级别的过滤帖子。
我的第一个猜测是,我必须设置一些变量来影响查询,对此有什么建议吗?还是有更好的方法来实现这一点?
<h2>Filter By Deployment:</h2>
<?php
$deployments = get_terms( \'deployments\', array(\'orderby\' => \'name\', \'order\' => \'ASC\', \'hide_empty\' => 1) );
echo \'<ul>\';
foreach ( $deployments as $deployment ) {
echo \'<li><a href="\'.get_term_link($deployment->slug, \'deployments\').\'">\'.$deployment->name.\'</a></li>\';
}
echo \'</ul>\';
?>
<h2>Filter By Category:</h2>
<?php
$categories = get_terms( \'category\', array(\'orderby\' => \'name\', \'order\' => \'ASC\', \'hide_empty\' => 1) );
echo \'<ul>\';
foreach ( $categories as $category ) {
echo \'<li><a href="\'.get_term_link($category->slug, \'category\').\'">\'.$category->name.\'</a></li>\';
}
echo \'</ul>\';
?>
<h2>Filter By Keyword:</h2>
<?php
$tags = get_terms( \'post_tag\', array(\'orderby\' => \'name\', \'order\' => \'ASC\', \'hide_empty\' => 1) );
echo \'<ul>\';
foreach ( $tags as $tag ) {
echo \'<li><a href="\'.get_term_link($tag->slug, \'post_tag\').\'">\'.$tag->name.\'</a></li>\';
}
echo \'</ul>\';
?>