I have a few hundred categories with many of them being “leaf” categories meaning that they do not have any child categories.
On all category pages that do have children, I am using the default Product Categories widget that comes with WordPress in order to display the child categories. This works exactly as I want it to.
However, on the leaf category pages, I would like to display the sibling categories in the same way (no tree, just a flat list of categories).
Is something like this possible with this plugin, or would some custom coding be required?
OnPoint Plugins
Hi JL,
The most straightforward way to accomplish a menu with all the top level categories would be to add the following filter to your active theme’s functions.php file:
This will honor the taxonomy set in your widget settings and display each top level category separately. You’ll also need the following widget options set:
Have a great night!
JL
Thanks for the code. However, although it did have an effect, Im not sure we are looking at the same thing.
Essentially this just displays the same five widgets on all category pages that appear to not have any relation to the actual category you are viewing.
Settings are exactly as recommended and code was added to the funcitons.php file of the child theme.
Just to be clear, I am just trying to show siblings on leaf categories. The user ends up nearly stuck and the siblings are the most relevant links you can display to keep them on the site.
OnPoint Plugins
Hi JL
This series of filters will make the following changes to your widget display:
You’ll want to uncheck the settings mentioned above as this widget will no longer require a top level:
Have a great weekend!
JL
Thanks for your help with this.
Not sure this is doing what intended though as its displaying all the categories.
Take a look at the screenshot below.
Also, is it possible we can just not show it all together on all pages except for leafs?
OnPoint Plugins
Is it displaying all categories when viewing a “leaf” category, or when viewing other categories which have parents and/or children?
JL
Yeah, it’s displaying on all category pages. On leaf categories, it is still burying the sibling categories with unrelated categories. Looks the same on all category pages..
OnPoint Plugins
Hi JL,
Can you tell me a bit more about what you mean by, “burying the the sibling categories with unrelated categories?”
How I understand it so far is leaf categories are top level categories.
Top level categories are only technically related to their children as siblings are simply every other top level category. Is there another way categories are related which could be used to determine which ones should display?
It may help to send some links to where I can see the menu along with an explanation of which links are currently showing that should not be.
OnPoint Plugins
Good morning JL,
In the meantime, we took another guess at what you are looking for and came up with the following filters. These expand on the last set of filters with the additional changes:
Have a great day!
JL
Sorry about the delay here.
What I meant by the siblings being buried only that non-sibling categories were being displayed and pushing the actual siblings down so far you couldn’t see them.
I tried the new code snippet and it’s now not showing on any of the pages. Any idea why that might be?
OnPoint Plugins
Hi JL,
I’m now convinced that you and I are not looking at the same things. :p
Here are some things which could help us get aligned with what you are trying to accomplish:
Have a great night!