I have created all of my Woocommerce product categories absolutely no problem there.
Now I want to build my shop menu using the categories. The problem is, I have multiple categories with the same name but have different parents.
As you can see from the image above I have no idea which categories "Carbon" or "Aluminum" belongs to although the structure has been setup correctly as you can see below...
I have searched for plugins that might help me build the menu but found nothing.
I have created all of my Woocommerce product categories absolutely no problem there.
Now I want to build my shop menu using the categories. The problem is, I have multiple categories with the same name but have different parents.
As you can see from the image above I have no idea which categories "Carbon" or "Aluminum" belongs to although the structure has been setup correctly as you can see below...
I have searched for plugins that might help me build the menu but found nothing.
Share Improve this question asked Jan 6, 2017 at 17:20 itsliamocoitsliamoco 1011 gold badge1 silver badge1 bronze badge3 Answers
Reset to default 2If there is a long list of categories, pagination breaks the hierarchy causing the issue OP is having.
This is a very long-standing issue. A plugin has been posted there, that disables pagination, so hierarchy is kept intact. Reported to work well up to 2500 categories & subcategories (after that it's probably a server timeout issue).
Or you can use this work-around solution (from the same discussion) in your functions.php, that also disables pagination in menu meta boxes:
<?php
add_filter( 'nav_menu_meta_box_object', 'disable_pagination_in_menu_meta_box', 9 );
function disable_pagination_in_menu_meta_box($obj) {
$obj->_default_query = array(
'posts_per_page' => -1
);
return $obj;
}
?>
By default it looks like these categories are indented in the "View All" tab:
So you shouldn't need an additional plugin to do this. My test site only has 38 categories, but it should still indent them.
That said, if you're repeating "Aluminum", "Carbon", "Steel", etc. then you might be best off having that as a separate custom taxonomy. The WordPress Codex has some details on how you could build that out.
There are easier ways of making taxonomies though. This site has you fill out some fields and then returns PHP you'd want to include in your theme's functions.php
file: https://generatewp/taxonomy/
Alternatively, plugins like Toolset Types have a UI to make that easier.
The answers above did not work for me.
In case anyone is looking for another solution, which did work for me, I used the following plugin/code as written by Sergey Biryukov, a core committer:
https://core.trac.wordpress/attachment/ticket/18282/preserve-page-and-taxonomy-hierarchy.php
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744494003a4577019.html
评论列表(0条)