I’m using the following code to add custom taxonomies to my menu in wordpress. I need to make these “sub” items under Products.
Example right now they are showing up:
Photography > Lighting
Photography > Cameras
I need them to show up as
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;
}
1 comment