WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Widgets
Suggestion: Better support for hierarchical categories (17 posts)

  1. Gwyneth Llewelyn
    Member
    Posted 3 years ago #

    DW already has good support for hierarchical pages, but on complex sites with hundreds of categories, organised hierarchically, many labels are pretty much the same, and this makes it hard to use DW quickly.

    Consider the following scenario:

    • Background colours
      • red
      • green
      • blue
    • Foreground colours
      • red
      • green
      • blue

    Since DW shows all categories sorted by name, this will produce a list to check from which looks like this:

    • Background colours
    • blue
    • blue
    • Foreground colours
    • green
    • green
    • red
    • red

    Not only the hierarchy is lost, but it makes it hard to see which of the instances for, say, blue is the right one :)

    It would be nice to have a toggle to display the categories either on alphabetical format or on hierarchical format. (Right now, my approach is to do a trial-and-error: check one, go to the site, see if I got the widget appearing on the desired category, go back if not, try another option, and so forth).

    An alternative is to list the slug for the category (for very deep hierarchies this might not be practical, as the slug can become very long, so it could appear just by hovering over the entry), which would go a long way to make the categories more easily identified, or add the category ID after the category name (also not perfect, since it requires looking it up elsewhere, but perhaps easier to implement).

    Note that WordPress is not very consistent in displaying categories either. The menu creation area, for example, suffers from the same problem: it's hard to figure out which category to add on a site with very deep hierarchies. Luckily, in this case, one can simply see what has been added and hover over the link for the category — which will reveal the hierarchy.

    Of course, this is really just useful on sites with very deep hierarchies and hundreds (as opposed to a few) of different categories. Sadly, it's my case :) I've tried to understand how the categories are requested by the DW plugin and change its code to add at least the ID, but I was afraid to break everything, so, well, I filed a request instead :)

    http://wordpress.org/extend/plugins/dynamic-widgets/

  2. Gwyneth Llewelyn
    Member
    Posted 3 years ago #

    Hrrmpf. The markup on the post completely broke the layout. Anyway, here goes what I meant with hierarchical categories:

    Background colours
     	red
    	green
    	blue
    Foreground colours
    	red
    	green
    	blue

    which become, under Dynamic Widgets category selection option:

    • Background colours
    • blue
    • blue
    • Foreground colours
    • green
    • green
    • red
    • red
  3. Qurl
    Member
    Plugin Author

    Posted 3 years ago #

    I'm going to have a look to add hierarchical support to categories. I think there will be a limit to 500 as this is the same case for static pages. This means when there are more then 500 categories, the list will be flat. This is to prevent time-out errors. I hope this is not a problem.

  4. Qurl
    Member
    Plugin Author

    Posted 3 years ago #

    Just to let you know I've just uploaded development version 1.4.0.7 which has hierarchical structure overview for Categories added.

  5. Gwyneth Llewelyn
    Member
    Posted 3 years ago #

    This is fantastic, Qurl! :) Thank you very much! To be perfect, it would be great if you could add the same hierarchical structure to the "Single Posts" option (where all categories are also displayed, too).

    Great work!

  6. Gwyneth Llewelyn
    Member
    Posted 3 years ago #

    After a few tests, I've noticed that a few categories are out of its hierarchical structure, but it's hard to understand what exactly is not correct. In one case, for instance, I have 4 whole subtrees that have a common parent, say, "Archives" (which in turn have a common parent, too). The entry for "Archives" is duplicated (with subtrees neatly split among them) even though the common parent is correct. Here I suspect some issues with WPML: apparently, although the language shown in DW is the "main" language for the site, those two "split" subtrees look like they come from different translations. It's hard to say for sure because DW correctly shows only the translation in the current language. So there might not be any duplication at all.

    Whew. This is definitely worth testing a lot! In any case, I seriously suspect now that I already had these "duplicated" entries on the very long category list, I just wasn't aware of them because I couldn't see the hierarchy easily...

  7. Qurl
    Member
    Plugin Author

    Posted 3 years ago #

    Ah, yes... of course. I'll add the hierarchical structure in Single Posts also. I completely forgot about that.

    I'm not testing for other WPML languages in Categories. Might be the problem tho. I'll add a test for it.

  8. Qurl
    Member
    Plugin Author

    Posted 3 years ago #

    And there is dev. version 1.4.0.8 with hierarchical structure for Categories in Single Posts added, testing for WPML and a bug fixed in Custom Post Types when using WPML.

  9. ig-ffm
    Member
    Posted 3 years ago #

    Thank you for the great plugin! Hierarchical display of categories is a very helpful improvement indeed!

    I'ld love to use the feature but there seems to be a bug. I just installed version 1.4.0.13 and not all of my categories are displayed correctly. Sometimes the hierarchy ist just wrong.

    I'm not sure about the pattern but it may have to be a problem concerning the "order by category name". The structure seems to break if the name of a sub-category begins with a letter prior in alphabet to the first of the main-category, for example products/car or products/flowers works but products/shoes does not.

    Maybe you are still working at this feature? (I know it's not a stable version yet.)
    Or is there anything to consider that I could have made wrong?

  10. Qurl
    Member
    Plugin Author

    Posted 3 years ago #

    I'm not aware of any problems with the hierarchical tree. Are you using other plugins working with categories?

  11. Qurl
    Member
    Plugin Author

    Posted 3 years ago #

    Please ignore my last question. I've already found the bug. It's fixed in 1.4.0.14

  12. Gwyneth Llewelyn
    Member
    Posted 3 years ago #

    I'm loving your recent changes, Qurl :) Although I'm always afraid to manually add a plugin outside the auto-update structure, on a "live" site with relatively great visibility (now that it's official, I can send the URL — http://www.alram.pt/ — the English version has few translations yet and that's why there is no direct link to it yet; notice how the small submenus at the top of the content are are dynamically changed [no, they're not breadcrumbs, the structure of those submenus is too complex for that] thanks to DW), I think I'll give 1.4.0.14 a try.

    I wish that the other WP areas that use categories were as good as Dynamic Widgets' hierarchical structure. From a non-hierarchical model which was confusing (as reported 2 months ago), Dynamic Widgets now does a far better job with hierarchical categories than WordPress itself, and from my tests with WP 3.2 Beta 2, it's clear that none of that will change.

    Great job, Qurl, and great plugin :)

  13. Gwyneth Llewelyn
    Member
    Posted 3 years ago #

    1.4.0.14 tested. Works like a charm, the hierarchies show as expected.

    Although deactivating and re-activating the plugin got me an anxiety attack when all of a sudden all widgets became static :)

    A quick fix was just to edit one of them (yes, it was properly flagged as dynamic) and save it. For some reason, although all were flagged as dynamic, they were treated as static until one of them was saved.

    And yes, I did full backups to make sure I could go back if something went seriously wrong when updating :-) Fortunately, it was as easy as opening one widget and saving it again to get all of them working.

  14. timebinder
    Member
    Posted 2 years ago #

    "think there will be a limit to 500 as this is the same case for static pages. This means when there are more then 500 categories, the list will be flat. This is to prevent time-out errors. I hope this is not a problem."

    I think this is the problem I have just encountered. Last week whilst setting up my dynamic widgets, I had a hierarchy showing for the Page selections with an option to include all pages within that section.

    Today I've gone to make adjustments and found the list is flat and doesn't show the box to 'include all pages within that section'.

    So now my site suddenly has a lot of pages without any menu at all as they have not been individually selected.

    Please help

  15. Qurl
    Member
    Plugin Author

    Posted 2 years ago #

    When you are using version 1.4.1 of DW, you can set the page limit yourself. In the overview page of DW, click on the 'Advanced >' link. You'll see now a 'Page limit' option. Set the page limit and hit 'Save'. Just a warning: When the tree building is not done within the execution time limit, the pages module will fail to load.

  16. timebinder
    Member
    Posted 2 years ago #

    Thanks for the quick response and that fixed it, although I don't know what 500 refers to as I have only 300 Pages. I set it to 600.

    And it seems some of the 'all childs' options actually were forgotten as I had to set them again.

  17. Qurl
    Member
    Plugin Author

    Posted 2 years ago #

    I understand it might look a bit weird. I must admit tough it's also a bit dirty. When the tree is displayed, the number of items doubles because of the 'All childs' options.

    When you've made a save of the rules of a widget, all not checked rules (obviously the 'All childs' are unchecked at that point as it doesn't exists anymore) are removed from the rulesets. That's unfortunately in this case by design.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic