OnPoint Plugins

  • Plugins
    • Advanced Sidebar Menu
    • Go Live Update Urls
  • About
    • Services
    • Showcase
  • Blog
  • Contact
  • Support
  • Log In
← Back to support

Display top level (Leaf) categories always

Resolved

Requested: 2 years and 1 month ago

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?

Plugin: Advanced Sidebar Menu

  1. OnPoint Plugins

    2 years and 1 month ago

    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:

    1. Display the highest level parent category
    2. Display menu when there is only the parent category

    Have a great night!

  2. JL

    2 years and 1 month ago

    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.

  3. OnPoint Plugins

    2 years and 1 month ago

    Hi JL

    This series of filters will make the following changes to your widget display:

    1. If the user is currently viewing a category which is.
      1. A top level category.
      2. Does not have any children.
    2. The widget will change.
      1. The widget will always display.
      2. The widget’s child categories will be a list of all existing top level categories.

    You’ll want to uncheck the settings mentioned above as this widget will no longer require a top level:

    1. Display the highest level parent category.
    2. Display menu when there is only the parent category.

    Have a great weekend!

     

  4. JL

    2 years and 1 month ago

    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?

  5. OnPoint Plugins

    2 years and 1 month ago

    Is it displaying all categories when viewing a “leaf” category, or when viewing other categories which have parents and/or children?

  6. JL

    2 years and 1 month ago

    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..

  7. OnPoint Plugins

    2 years and 1 month ago

    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.

  8. OnPoint Plugins

    2 years and 1 month ago

    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:

    1. Widgets will only display on categories which have no children.
    2. The list of displayed categories will only include categories which have no children.

    Have a great day!

  9. JL

    2 years and 1 month ago

    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?

  10. OnPoint Plugins

    2 years and 1 month ago

    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:

    1. Remove any filters provided so far.
    2. Add the widget to sidebar with the default settings, except for taxonomy which will need to be set to the one you are using.
    3. Provide some links to categories which display the widget.
      1. List some categories which you prefer to not being displayed.
    4. Provide some links to categories where the widget is not displayed but you would like it to.
      1. List the categories which you prefer to be displaying which are not.
      2. Explain the relation to the category you are currently viewing.

    Have a great night!

New Response Cancel reply

You must be logged in to respond. Only PRO members are allowed to respond to support requests.

© 2023 · WordPress Development · Terms Of Service · Privacy Policy · Cookie Policy · Log in

  • Plugins
  • Blog
  • Contact