Customizer – Controls on Primary Menu
-
I’m trying to add some custom controls to only the Primary Menu. I can get the control to show up when on a specific menu, albeit not very pretty since it butts right up against the menu items but it still adds it:
function theme_customizer_controls( $customizer ) { // Arbitrary Control $customizer->add_setting( 'theme_something', array( 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field', ) ); $customizer->add_control( 'theme_something', array( 'label' => __( 'Something', 'theme' ), 'section' => 'nav_menu[2]', 'settings' => 'theme_something', 'type' => 'text', ) ); } add_action( 'customize_register', 'theme_customizer_controls' );
The problem is that the section slug appears to have an array index so it would be difficult to tell if the primary menu is at index 2, 3, or 10. Is there a way to only show this control whenever viewing the Primary Menu?
I’m not opposed to using JS to hide / show the controls either if that’s an option.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Customizer – Controls on Primary Menu’ is closed to new replies.