我正在使用以下代码将自定义分类法添加到我的 wordpress 菜单中。我需要在产品下制作这些“子”项目。
现在他们出现的例子:
Photography > Lighting
Photography > Cameras
我需要他们显示为
Products > Photography > Lighting
Products > Photography > Cameras
add_filter( 'wp_page_menu', 'custom_page_nav', 90 );
function custom_page_nav( $menu )
{
$taxonomy = 'catalog';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 1; // 1 for yes, 0 for no
$hierarchical = true; // 1 for yes, 0 for no
$title = '';
$args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical, 'title_li' => false, 'echo' => false, 'empty' => true, 'hide_empty' => false,
'depth' => 0 );
$links .= wp_list_categories( $args );
// $links .= wp_list_categories( array( 'title_li' => false, 'echo' => false, 'empty' => true ) );
$menu = str_replace( '', $links . '', $menu );
return $menu;
}