• Resolved lucspe

    (@lucspe)


    Hi,

    Just wondering if there is a design reason why “Menu Sections” are not registered as hierarchical but as tags?

    I like the plugin very much but in terms of usability having a list of category check boxes to assign an item to a section would make more sense for the project where I’d have to use it.

    Changing the way the taxonomy is registered seems rather easy but I wanted to check with you if this would break anything.

    Thanks for the explanation,
    Luca

    https://wordpress.org/plugins/food-and-drink-menu/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Luca,

    The plugin doesn’t actually treat the Menu Sections as hierarchical. So if you nest one section under another section, it won’t load and display child sections or anything. It behaves as if the sections are not hierarchical.

    However, if all you want is the default hierarchical UI, you can make the change and the plugin should still load sections fine. You can hook into [this filter](https://github.com/NateWr/food-and-drink-menu/blob/master/cpts.php#L108) to make the change without touching the plugin.

    Thread Starter lucspe

    (@lucspe)

    Hi,

    Thanks for the reply.

    I’ve tried adding hierarchical without rewriting the whole array using the following code, but it doesn’t work:

    add_filter( 'fdm_menu_item_args', 'fdm_hierarchical_taxonomies' );
    function fdm_hierarchical_taxonomies( $menu_item_taxonomies ) {
        $menu_item_taxonomies['hierarchical'] = 'true';
        return $menu_item_taxonomies;
    }

    any idea of what I am doing wrong?

    Hi Luca,

    You want to hook into the menu item taxonomy arguments filter, which is fdm_menu_item_taxonomies, not fdm_menu_item_args. You can find the correct filter here.

    Thread Starter lucspe

    (@lucspe)

    Ok, thanks, my mistake (lesson learned not to look at these things at 3am in the night, my timezone 🙂 )

    At any rate, this seems to work, in case anybody else needs it:

    add_filter( 'fdm_menu_item_taxonomies', 'fdm_hierarchical_taxonomies' );
    function fdm_hierarchical_taxonomies( $menu_item_taxonomies ) {
        $menu_item_taxonomies['fdm-menu-section']['hierarchical'] = 'true';
        return $menu_item_taxonomies;
    }

    Thanks again.

    Thanks for sharing the final result Luca. If you get a chance, please leave a review for the plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Menu sections as hierarchical’ is closed to new replies.