diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/widgets/class-wp-nav-menu-widget.php --- a/wp/wp-includes/widgets/class-wp-nav-menu-widget.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-includes/widgets/class-wp-nav-menu-widget.php Mon Oct 14 18:28:13 2019 +0200 @@ -23,10 +23,10 @@ */ public function __construct() { $widget_ops = array( - 'description' => __( 'Add a navigation menu to your sidebar.' ), + 'description' => __( 'Add a navigation menu to your sidebar.' ), 'customize_selective_refresh' => true, ); - parent::__construct( 'nav_menu', __('Navigation Menu'), $widget_ops ); + parent::__construct( 'nav_menu', __( 'Navigation Menu' ), $widget_ops ); } /** @@ -59,7 +59,7 @@ $nav_menu_args = array( 'fallback_cb' => '', - 'menu' => $nav_menu + 'menu' => $nav_menu, ); /** @@ -114,15 +114,27 @@ */ public function form( $instance ) { global $wp_customize; - $title = isset( $instance['title'] ) ? $instance['title'] : ''; + $title = isset( $instance['title'] ) ? $instance['title'] : ''; $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : ''; // Get menus $menus = wp_get_nav_menus(); + $empty_menus_style = $not_empty_menus_style = ''; + if ( empty( $menus ) ) { + $empty_menus_style = ' style="display:none" '; + } else { + $not_empty_menus_style = ' style="display:none" '; + } + + $nav_menu_style = ''; + if ( ! $nav_menu ) { + $nav_menu_style = 'display: none;'; + } + // If no menus exists, direct the user to go and create some. ?> -
-