From 5a356a33f6cb65e8a1c6edfc9446f609eb372450 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Mon, 11 Jan 2021 12:43:53 +0000 Subject: [PATCH] check that menus have items before outputting them --- seedlet/template-parts/header/navigation.php | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/seedlet/template-parts/header/navigation.php b/seedlet/template-parts/header/navigation.php index 0eced1453..3d8ec06f2 100644 --- a/seedlet/template-parts/header/navigation.php +++ b/seedlet/template-parts/header/navigation.php @@ -1,7 +1,23 @@ - + $has_primary_nav = has_nav_menu( 'primary' ); + $has_primary_nav_items = wp_nav_menu( + array( + 'theme_location' => 'primary', + 'fallback_cb' => false, + 'echo' => false, + ) + ); + $has_social_nav = has_nav_menu( 'social' ); + $has_social_nav_items = wp_nav_menu( + array( + 'theme_location' => 'social', + 'fallback_cb' => false, + 'echo' => false, + ) + ); + + ?> +