• I have created a section for the menu and the “select” attribute in this section. I have 5 different menus for my site and I need all the menus to connect to wordpress customizer. How to connect them? What function to enter and where? Now I have 1 active menu and 4 hidden on my website. It is necessary that the user in wordpress customizer could choose what he liked, and this was shown, and the rest are hidden.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you writing your own theme? Or are you using a theme someone else has designed?

    If the latter case, menu locations are theme dependent. The only way to override that is with a child theme.

    Thread Starter bogette

    (@bogette)

    @kjodle No, no, no. This is my own theme (layout, which was rewritten in php for wordpress). And then (in the editor – ATOM) I created a variations of the menu, one of which made displayed on the site, and the other 4 hidden. And now I need to make it possible for the end user to choose the menu they like using wordpress customizer. I figured out how to create wordpress customizer sections, settings, etc. But I do not understand how to connect the menu (5 pieces) created by me to this section. Could you give me a hint?

    If they are not WordPress menus, then they are just options from your theme? So the theme can supply an option in the Customizer to select from the list of 5, and the one chosen is output.

    But it is much easier for the user if the menu is created by them with a standard WordPress menu, so that all the existing functionality is usable (including plugins which enhance menus). Then if you want the menu markup to be different, the theme would supply different menu walker code to output the different markup. That choice could still be a Customizer option, but the content of the menu needs to be easy for the user to do.

    Thread Starter bogette

    (@bogette)

    Hi @joyously

    The fact is that these are very “creative menus” – so I can not use the wordpress menu. If it is possible to connect an arbitrary menu to the wordpress menu, please let me know about it. The problem is that I do not know how to retrieve these 5 menus from the database. This is definitely done with the get_theme-mod function, but I do not know how to use this function with the “select” parameter. After all, it’s important to understand that I have not one element, and 5. And how do I retrieve them from the database?

    • This reply was modified 6 years, 9 months ago by bogette.

    Menus are simply placeholders. To add a menu area to a theme, you first add code where you want the menu to appear (header.php, single.php, etc.) and then you add code to add a customizer option.

    From what you’re describing, it doesn’t sound like a standard WordPress menu at all. You may be better off doing this as a regular theme option that allows a user to insert one of your special menus via a php include() function.

    The fact is that these are very “creative menus” – so I can not use the wordpress menu.

    Without seeing actual code, we have no idea what makes these “creative”. A bit of code would help. What are you actually trying to insert into that location?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to connect a menu to wordpress customizer.’ is closed to new replies.