我已经创建了新的帖子类型“groceries”,创建了“fruit”分类法,并添加了一堆类别,但当我过滤这个类别时,url显示如下.localhost/fruit/apple
我想展示一下.localhost/groceries/fruit/apple
如何做到这一点我正在使用此基本过滤器:
<li id="categories_topics">
<?php
$args = array(
\'show_option_none\' => \'Select category\',
\'taxonomy\' => \'fruit\',
\'field\' => \'slug\',
\'id\' => \'cat\',
);
?>
<?php wp_dropdown_categories( $args ); ?>
<script type="text/javascript">
<!--
var dropdown = document.getElementById("cat");
function onCatChange() {
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
var str = $( "#cat option:selected" ).text();
str = str.replace(/\\s+/g, \'-\').toLowerCase();
location.href = "<?php echo esc_url( home_url( \'/\' ) ); ?>?fruit="+str
}
}
dropdown.onchange = onCatChange;
-->
</script>
</li>
当我离开时:
.localhost/groceries/fruit/apple
显示404但是
.localhost/fruit/apple
工作正常