[wp-trac] [WordPress Trac] #39040: Refresh Menu Locations in Customizer after refresh

WordPress Trac noreply at wordpress.org
Sat Dec 3 12:16:55 UTC 2016


#39040: Refresh Menu Locations in Customizer after refresh
-----------------------------+-----------------------------
 Reporter:  khela            |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Customize        |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Could be helpful to have menu locations automatically updated when
 switching template parts. For example if I have two header style:

 header-singlemenu.php
 {{{#!php
 <?php wp_nav_menu( array(
     'theme_location' => 'primary',
 ));
 }}}

 header-doublemenu.php
 {{{#!php
 <?php
 wp_nav_menu( array(
     'theme_location' => 'primary-left',
 ));
 wp_nav_menu( array(
     'theme_location' => 'primary-right',
 ));

 }}}

 Those got by

 {{{#!php
   <?php get_template_part('header',
 get_theme_mod('header_style','singlemenu') ); ?>
 }}}

 where ''header_style'' obviously can be '''singlemenu''' or
 '''doublemenu'''
 in functions.php i have

 {{{#!php
 <?php
     if(get_theme_mod('header_style', 'singlemenu') == 'singlemenu')
     {
         register_nav_menu( 'primary', __( 'Primary Menu', 'theme-slug' )
 );
     }
     else
     {
         register_nav_menu( 'primary-left', __( 'Left Menu', 'theme-slug' )
 );
         register_nav_menu( 'primary-right', __( 'Right Menu', 'theme-slug'
 ) );
     }
 }}}

 When switching header style in customizer, menu location are not updated.
 You are bound to save your customization, reload the page and then you can
 be able to see new location.

 [[Image(https://i.gyazo.com/9fe4cca23b88c55877d65431c756f3a4.gif)]]

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39040>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list