Home › Forums › Backend Issues (wp-admin) › Menus in relational fields
I have certain menus load on posts in particular categories. For example, in my wordpress menus I’ll have a Cars & Trucks menu that I want to appear on posts in the Cars and Trucks categories. I do this by putting conditionals in my single.php that load the correct menu.
But if I add new menus and categories, the single.php has to be re-written. I’d like to have a relational field that associates a menu with a category term. Is it possible?
There is an addon plugin that I use regularly for allowing clients to add menus. https://wordpress.org/plugins/advanced-custom-fields-nav-menu-field/
Hi @hube2 @photocurio !
Do you plan to add this into core for that ? The plugin you mentioned has not been updated for 4 years…
Thank you in advance !
Sorry, neither of us are ACF devs. You’d have to ask that of the dev team. https://www.advancedcustomfields.com/contact/
I haven’t actually used that plugin in a while, this was posted a long time ago. When I want to do this now I just use a select field that is dynamically populated with choices for menus that have been created (https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/). I then code the template to show the selected menu using standard WP functions. The reason for this is so that I can do custom work that the plugin could not handle and the second reason is that I don’t like being dependent on 3rd party addons for ACF because of this very reason, you never know when the dev will stop supporting them.
I’m not sure why I was trying to include a menu that way when I posted, but if I was doing it now I would:
The topic ‘Menus in relational fields’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.