From 9e3ab4d4557a38b35f2870d7f6dde2ec4105ada5 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Fri, 1 Oct 2021 08:50:55 -0400
Subject: [PATCH 01/13] Set depth for top level and 1 level of the heirarchy

---
 inc/template-tags.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index d9bc1e3c..f1c879b0 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -434,6 +434,7 @@ function responsive_get_utility_nav( $args = array() ) {
 					'menu_class'     => 'utility-nav-menu',
 					'container'      => false,
 					'echo'           => false,
+					'depth'          => 2,
 				)
 			);
 		}

From 363bae4cbb206bc869b18456613eec0571f1b148 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Mon, 4 Oct 2021 12:53:27 -0400
Subject: [PATCH 02/13] limit output of utility nav

---
 inc/template-tags.php | 46 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index f1c879b0..4628c873 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1211,3 +1211,49 @@ function responsive_get_the_excerpt( $post_id = null, $length = 55 ) {
 	}
 	return $excerpt;
 }
+
+
+/**
+ * Limit the children output from the utility menu to three.
+ *
+ * @param string   $items The HTML list content for the menu items.
+ * @param stdClass $args  An object containing wp_nav_menu() arguments.
+ * @return string The HTML Menu items.
+ */
+function limit_utility_nav_menu_items( $items, $args ) {
+
+	// Build XML document for processing.
+	$items = "<root>$items</root>";
+	$dom   = new DOMDocument();
+	$dom->loadXML( $items );
+	$doc      = $dom->documentElement;
+	$submenus = $doc->getElementsByTagName( 'ul' );
+
+	$nodes_to_remove = array();
+
+	// Find nodes to remove.
+	foreach ( $submenus as $key => $submenu ) {
+		$lis      = $submenu->getElementsByTagName( 'li' );
+		$li_count = $lis->length;
+
+		// Allow maximum of 3 children per submenu.
+		// Adapt counter for zero indexing of DOM document.
+		if ( 3 < $li_count ) {
+			for ( $i = $li_count - 1; $i > 2; $i-- ) {
+				$node = $lis->item( $i );
+				array_push( $nodes_to_remove, $node );
+			}
+		}
+	}
+
+	// Remove Nodes.
+	foreach ( $nodes_to_remove as $node ) {
+		$node->parentNode->removeChild( $node );
+	}
+
+	// Prepare Return Values.
+	$items = $dom->saveXML();
+	$items = str_replace( array( '<root>', '</root>' ), '', $items );
+	return $items;
+}
+add_filter( 'wp_nav_menu_items', 'limit_utility_nav_menu_items', 10, 2 );

From 2153329cc796fa430d6485430a6b01281288c521 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Fri, 8 Oct 2021 12:20:28 -0400
Subject: [PATCH 03/13] add admin warning notice for utility menu prefix
 function names

---
 inc/template-tags.php | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index 4628c873..9061ad70 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1220,7 +1220,7 @@ function responsive_get_the_excerpt( $post_id = null, $length = 55 ) {
  * @param stdClass $args  An object containing wp_nav_menu() arguments.
  * @return string The HTML Menu items.
  */
-function limit_utility_nav_menu_items( $items, $args ) {
+function responsive_limit_utility_nav_menu_items( $items, $args ) {
 
 	// Build XML document for processing.
 	$items = "<root>$items</root>";
@@ -1253,7 +1253,37 @@ function limit_utility_nav_menu_items( $items, $args ) {
 
 	// Prepare Return Values.
 	$items = $dom->saveXML();
-	$items = str_replace( array( '<root>', '</root>' ), '', $items );
+	$items = str_replace(
+		array(
+			'<root>',
+			'</root>',
+		),
+		'',
+		$items
+	);
 	return $items;
 }
-add_filter( 'wp_nav_menu_items', 'limit_utility_nav_menu_items', 10, 2 );
+add_filter( 'wp_nav_menu_items', 'responsive_limit_utility_nav_menu_items', 10, 2 );
+
+/**
+ * Add Admin notice describing limitations of the Utility menu.
+ */
+function responsive_utility_menu_notice() {
+
+	// Display only on nav-menus screen.
+	$screen = get_current_screen();
+	if ( 'nav-menus' !== $screen->base ) {
+		return;
+	}
+
+	// Get Current menu id from the global namespace and compare to the utility-menu id.
+	global $nav_menu_selected_id;
+	$utility_menu = wp_get_nav_menu_object( 'utility-menu' );
+
+	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
+		$notice  = 'The Utility has a maximum hierachy depth of 1 and sub items of 3.<br>';
+		$notice .= 'More items may display in Menu Struture below but those items will not display on your site.';
+		echo '<div class="notice notice-warning">' . esc_html( $notice ) . '</div>';
+	}
+}
+add_action( 'admin_notices', 'responsive_utility_menu_notice' );

From 7260a60597acdf1b5d307e80a4f3831b0a8f30ba Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 12 Oct 2021 10:45:08 -0400
Subject: [PATCH 04/13] remove child xml processing not needed with depth at 1

---
 inc/template-tags.php | 58 +++----------------------------------------
 1 file changed, 3 insertions(+), 55 deletions(-)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index 9061ad70..c9f4b2b8 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -434,7 +434,7 @@ function responsive_get_utility_nav( $args = array() ) {
 					'menu_class'     => 'utility-nav-menu',
 					'container'      => false,
 					'echo'           => false,
-					'depth'          => 2,
+					'depth'          => 1,
 				)
 			);
 		}
@@ -1213,58 +1213,6 @@ function responsive_get_the_excerpt( $post_id = null, $length = 55 ) {
 }
 
 
-/**
- * Limit the children output from the utility menu to three.
- *
- * @param string   $items The HTML list content for the menu items.
- * @param stdClass $args  An object containing wp_nav_menu() arguments.
- * @return string The HTML Menu items.
- */
-function responsive_limit_utility_nav_menu_items( $items, $args ) {
-
-	// Build XML document for processing.
-	$items = "<root>$items</root>";
-	$dom   = new DOMDocument();
-	$dom->loadXML( $items );
-	$doc      = $dom->documentElement;
-	$submenus = $doc->getElementsByTagName( 'ul' );
-
-	$nodes_to_remove = array();
-
-	// Find nodes to remove.
-	foreach ( $submenus as $key => $submenu ) {
-		$lis      = $submenu->getElementsByTagName( 'li' );
-		$li_count = $lis->length;
-
-		// Allow maximum of 3 children per submenu.
-		// Adapt counter for zero indexing of DOM document.
-		if ( 3 < $li_count ) {
-			for ( $i = $li_count - 1; $i > 2; $i-- ) {
-				$node = $lis->item( $i );
-				array_push( $nodes_to_remove, $node );
-			}
-		}
-	}
-
-	// Remove Nodes.
-	foreach ( $nodes_to_remove as $node ) {
-		$node->parentNode->removeChild( $node );
-	}
-
-	// Prepare Return Values.
-	$items = $dom->saveXML();
-	$items = str_replace(
-		array(
-			'<root>',
-			'</root>',
-		),
-		'',
-		$items
-	);
-	return $items;
-}
-add_filter( 'wp_nav_menu_items', 'responsive_limit_utility_nav_menu_items', 10, 2 );
-
 /**
  * Add Admin notice describing limitations of the Utility menu.
  */
@@ -1281,8 +1229,8 @@ function responsive_utility_menu_notice() {
 	$utility_menu = wp_get_nav_menu_object( 'utility-menu' );
 
 	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
-		$notice  = 'The Utility has a maximum hierachy depth of 1 and sub items of 3.<br>';
-		$notice .= 'More items may display in Menu Struture below but those items will not display on your site.';
+		$notice  = 'The Utility Menu only displays the top level items.<br>';
+		$notice .= 'More items may display in Menu Structure below but those items will not display on your site.';
 		echo '<div class="notice notice-warning">' . esc_html( $notice ) . '</div>';
 	}
 }

From 75b39014e956fe14d7e9427e270c9a33bcbb401f Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 12 Oct 2021 10:48:25 -0400
Subject: [PATCH 05/13] Update message

---
 inc/template-tags.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index c9f4b2b8..0b7fb799 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1229,7 +1229,7 @@ function responsive_utility_menu_notice() {
 	$utility_menu = wp_get_nav_menu_object( 'utility-menu' );
 
 	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
-		$notice  = 'The Utility Menu only displays the top level items.<br>';
+		$notice  = 'The Utility Menu only displays the top level items. ';
 		$notice .= 'More items may display in Menu Structure below but those items will not display on your site.';
 		echo '<div class="notice notice-warning">' . esc_html( $notice ) . '</div>';
 	}

From 8b07129fff97b8197299073b9f1511cecabc91e3 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 12 Oct 2021 12:34:22 -0400
Subject: [PATCH 06/13] add deletion of nested Utility Nav Items

---
 inc/template-tags.php | 47 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index 0b7fb799..40ebe3a1 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1230,8 +1230,53 @@ function responsive_utility_menu_notice() {
 
 	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
 		$notice  = 'The Utility Menu only displays the top level items. ';
-		$notice .= 'More items may display in Menu Structure below but those items will not display on your site.';
+		$notice .= 'More items may display in Menu Structure below but those items will not display on your site and will be deleted on a subsequent save.';
 		echo '<div class="notice notice-warning">' . esc_html( $notice ) . '</div>';
 	}
 }
 add_action( 'admin_notices', 'responsive_utility_menu_notice' );
+
+
+/**
+ * Delete any menu items not at the top level for the utility menu.
+ *
+ * @param int   $menu_id The ID of the menu.
+ * @param array $menu_data An array of menu data that has the menu name.
+ */
+function responsive_update_utility_menu( int $menu_id, $menu_data = array() ) {
+
+	// Return if no data to update.
+	if ( empty( $menu_id ) || empty( $menu_data ) ) {
+		return;
+	}
+
+	$utility_menu_id = wp_get_nav_menu_object( 'utility-menu' )->term_id;
+
+	$count = 0;
+	// Only update Utility Menu.
+	if ( $menu_id === $utility_menu_id ) {
+		$menu_items = wp_get_nav_menu_items( 'utility-menu' );
+		foreach ( $menu_items as $item ) {
+
+			// Delete menu items that are not on the top level.
+			if ( (int) 0 !== (int) $item->menu_item_parent ) {
+				wp_delete_post( (int) $item->ID );
+				$count++;
+			}
+		}
+	}
+
+	if ( 0 < $count ) {
+		add_action( 'admin_notices', 'responsive_utility_menu_items_deleted_notice' );
+	}
+
+}
+add_action( 'wp_update_nav_menu', 'responsive_update_utility_menu', 10, 2 );
+
+/**
+ * Add message that Utility Menu Items have been deleted.
+ */
+function responsive_utility_menu_items_deleted_notice() {
+	echo '<div class="notice notice-error is-dismissible">Utility Menu Items below the top level have been deleted.</div>';
+}
+

From 969e6918284e81e170ad47c5aa13f3813cc1fb5b Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Thu, 14 Oct 2021 09:56:00 -0400
Subject: [PATCH 07/13] add JS to block adding child menu items

---
 CHANGELOG.md    |  6 ++++++
 admin/admin.php |  9 +++++++++
 admin/menu.js   | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 admin/menu.js

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff030286..0a3576bb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
 # Changelog
 
+## Unreleased
+
+- Restrict utility menu output to the parent level, fixes #61.
+- Prevent child menu items from being added to the Utility menu, fixes #61.
+- Delete child menu items from the Utility menu on save operation, fixes #61.
+
 ## 2.5.2
 
 - Add alternate-footbar class to alternate-footbar fixes#5.
diff --git a/admin/admin.php b/admin/admin.php
index 4c9558b6..3132511c 100755
--- a/admin/admin.php
+++ b/admin/admin.php
@@ -129,3 +129,12 @@ function responsive_maybe_save_layout_setting() {
 	set_transient( 'responsive_layout_setting_check', '', WEEK_IN_SECONDS );
 }
 add_action( 'admin_init', 'responsive_maybe_save_layout_setting' );
+
+/**
+ * Enqueue Custom Admin Menu Scripts.
+ */
+function responsive_enqueue_admin_scripts() {
+	wp_enqueue_script( 'custom-menu-js', get_template_directory_uri() . '/admin/menu.js', array(), RESPONSIVE_FRAMEWORK_VERSION, true );
+
+}
+add_action( 'admin_enqueue_scripts', 'responsive_enqueue_admin_scripts', 20 );
diff --git a/admin/menu.js b/admin/menu.js
new file mode 100644
index 00000000..a6bc3457
--- /dev/null
+++ b/admin/menu.js
@@ -0,0 +1,32 @@
+jQuery( document ).ready(function($) {
+	function verifyNav() {
+		let lis = jQuery('#update-nav-menu #post-body ul.menu li');
+		lis.each(function () {
+			// First Check if active in sort and don't act on the placeholder dive.
+			if ( !$(this).hasClass('ui-sortable-helper') && !$(this).hasClass('sortable-placeholder')) {
+				// If not active and not at 0 depth remove.
+				if ( !$(this).hasClass('menu-item-depth-0') ) {
+					window.alert('Menu Item removed. Nesting not allowed on Utility menu.');
+					$(this).remove();
+				}
+			}
+		});
+	}
+
+	// Setup Observer only on Utility Menu.
+	let selectedMenu = jQuery('.manage-menus select').find(':selected').text();
+
+	if( 'Utility Menu (Utility Navigation)' === selectedMenu.trim() ) {
+		// Select the node that will be observed for mutations.
+		const targetNode = document.getElementById('update-nav-menu');
+
+		// Options for the observer (which mutations to observe).
+		const config = {attributes: true, childList: true, subtree: true};
+
+		// Create an observer instance linked to the callback function.
+		const observer = new MutationObserver(verifyNav);
+
+		// Start observing the target node for configured mutations
+		observer.observe(targetNode, config);
+	}
+});

From 4589dcdc59e15209a4d7dd0df84f9dd280095b00 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Thu, 14 Oct 2021 12:28:37 -0400
Subject: [PATCH 08/13] swap deletion of item to reset item to top level

---
 admin/menu.js | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/admin/menu.js b/admin/menu.js
index a6bc3457..a1b7cd53 100644
--- a/admin/menu.js
+++ b/admin/menu.js
@@ -4,10 +4,20 @@ jQuery( document ).ready(function($) {
 		lis.each(function () {
 			// First Check if active in sort and don't act on the placeholder dive.
 			if ( !$(this).hasClass('ui-sortable-helper') && !$(this).hasClass('sortable-placeholder')) {
-				// If not active and not at 0 depth remove.
+				// If not active and not at 0 depth reset to 0 depth and alert user.
 				if ( !$(this).hasClass('menu-item-depth-0') ) {
-					window.alert('Menu Item removed. Nesting not allowed on Utility menu.');
-					$(this).remove();
+					let itemID = $(this).attr('id');
+					let item = document.getElementById( itemID );
+					let itemClasses = item.className;
+					itemClasses = itemClasses.split( ' ' );
+					itemClasses.forEach((element, index) => {
+						if ( -1 !== element.toString().indexOf('menu-item-depth') ) {
+							let currentDepthClass = itemClasses[index];
+							$(this).removeClass(currentDepthClass);
+							$(this).addClass('menu-item-depth-0');
+							window.alert( 'Nested menu items not allowed. Menu item Reset to top level.');
+						}
+					} );
 				}
 			}
 		});

From 90c3f8f4f42192f6de10d97d50de2f1f1e180ca9 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Mon, 18 Oct 2021 10:50:22 -0400
Subject: [PATCH 09/13] change methodology to reset nav items to parent level
 instead of deleting the items. Update Alert message. Update Notice.

---
 admin/menu.js         |  3 ++-
 inc/template-tags.php | 16 +++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/admin/menu.js b/admin/menu.js
index a1b7cd53..1f4f0c5f 100644
--- a/admin/menu.js
+++ b/admin/menu.js
@@ -15,7 +15,8 @@ jQuery( document ).ready(function($) {
 							let currentDepthClass = itemClasses[index];
 							$(this).removeClass(currentDepthClass);
 							$(this).addClass('menu-item-depth-0');
-							window.alert( 'Nested menu items not allowed. Menu item Reset to top level.');
+							$(this).find( '.is-submenu').hide();
+							window.alert( 'Nested menu items not allowed on Utility Menu. Menu item Reset to top level.');
 						}
 					} );
 				}
diff --git a/inc/template-tags.php b/inc/template-tags.php
index 40ebe3a1..aad414cd 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1229,9 +1229,9 @@ function responsive_utility_menu_notice() {
 	$utility_menu = wp_get_nav_menu_object( 'utility-menu' );
 
 	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
-		$notice  = 'The Utility Menu only displays the top level items. ';
-		$notice .= 'More items may display in Menu Structure below but those items will not display on your site and will be deleted on a subsequent save.';
-		echo '<div class="notice notice-warning">' . esc_html( $notice ) . '</div>';
+		$notice  = 'The Utility Menu only displays the top level items.<br> ';
+		$notice .= 'More items may display in the Menu Structure but those items will be reset to the top level on save.';
+		echo '<div class="notice notice-warning">' . wp_kses_post( $notice ) . '</div>';
 	}
 }
 add_action( 'admin_notices', 'responsive_utility_menu_notice' );
@@ -1258,10 +1258,10 @@ function responsive_update_utility_menu( int $menu_id, $menu_data = array() ) {
 		$menu_items = wp_get_nav_menu_items( 'utility-menu' );
 		foreach ( $menu_items as $item ) {
 
-			// Delete menu items that are not on the top level.
-			if ( (int) 0 !== (int) $item->menu_item_parent ) {
-				wp_delete_post( (int) $item->ID );
+			// Move any child menu items to the top/parent level.
+			if ( 0 !== (int) $item->menu_item_parent ) {
 				$count++;
+				update_post_meta( $item->ID, 'menu_item_parent', 0 );
 			}
 		}
 	}
@@ -1269,7 +1269,6 @@ function responsive_update_utility_menu( int $menu_id, $menu_data = array() ) {
 	if ( 0 < $count ) {
 		add_action( 'admin_notices', 'responsive_utility_menu_items_deleted_notice' );
 	}
-
 }
 add_action( 'wp_update_nav_menu', 'responsive_update_utility_menu', 10, 2 );
 
@@ -1277,6 +1276,5 @@ function responsive_update_utility_menu( int $menu_id, $menu_data = array() ) {
  * Add message that Utility Menu Items have been deleted.
  */
 function responsive_utility_menu_items_deleted_notice() {
-	echo '<div class="notice notice-error is-dismissible">Utility Menu Items below the top level have been deleted.</div>';
+ 	echo '<div class="notice notice-error is-dismissible">Nested Utility Menu Items not allowed. All menu items reset to the the top level.</div>';
 }
-

From 30b550150bafe65042af372cead8221b3ab515a9 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 19 Oct 2021 10:46:12 -0400
Subject: [PATCH 10/13] update change log add i18n update comments

---
 CHANGELOG.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a3576bb..e17ebbf7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,8 @@
 
 - Restrict utility menu output to the parent level, fixes #61.
 - Prevent child menu items from being added to the Utility menu, fixes #61.
-- Delete child menu items from the Utility menu on save operation, fixes #61.
+- Reset nested Utility menu items to the top/parent level on save, fixes #61.
+- Add admin notice stating the utility nav restrictions, fixes #61.
 
 ## 2.5.2
 

From 3b5c3ff1c4c6324f3a0a34d23a2b4922732f3c67 Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 19 Oct 2021 10:47:15 -0400
Subject: [PATCH 11/13] update comments add i18n

---
 admin/menu.js         |  2 +-
 inc/template-tags.php | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/admin/menu.js b/admin/menu.js
index 1f4f0c5f..6c80dad7 100644
--- a/admin/menu.js
+++ b/admin/menu.js
@@ -2,7 +2,7 @@ jQuery( document ).ready(function($) {
 	function verifyNav() {
 		let lis = jQuery('#update-nav-menu #post-body ul.menu li');
 		lis.each(function () {
-			// First Check if active in sort and don't act on the placeholder dive.
+			// First Check if active in sort and don't act on the placeholder span.
 			if ( !$(this).hasClass('ui-sortable-helper') && !$(this).hasClass('sortable-placeholder')) {
 				// If not active and not at 0 depth reset to 0 depth and alert user.
 				if ( !$(this).hasClass('menu-item-depth-0') ) {
diff --git a/inc/template-tags.php b/inc/template-tags.php
index aad414cd..2246b569 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1229,8 +1229,9 @@ function responsive_utility_menu_notice() {
 	$utility_menu = wp_get_nav_menu_object( 'utility-menu' );
 
 	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
-		$notice  = 'The Utility Menu only displays the top level items.<br> ';
-		$notice .= 'More items may display in the Menu Structure but those items will be reset to the top level on save.';
+		$notice  = __( 'The Utility Menu only displays the top level items.', 'responsive-framework' );
+		$notice .= '<br>';
+		$notice .= __( 'More items may display in the Menu Structure but those items will be reset to the top level on save.', 'responsive-framework' );
 		echo '<div class="notice notice-warning">' . wp_kses_post( $notice ) . '</div>';
 	}
 }
@@ -1238,7 +1239,7 @@ function responsive_utility_menu_notice() {
 
 
 /**
- * Delete any menu items not at the top level for the utility menu.
+ * Reset any nested menu items to the top/parent level for the utility menu.
  *
  * @param int   $menu_id The ID of the menu.
  * @param array $menu_data An array of menu data that has the menu name.
@@ -1260,8 +1261,8 @@ function responsive_update_utility_menu( int $menu_id, $menu_data = array() ) {
 
 			// Move any child menu items to the top/parent level.
 			if ( 0 !== (int) $item->menu_item_parent ) {
-				$count++;
 				update_post_meta( $item->ID, 'menu_item_parent', 0 );
+				$count++;
 			}
 		}
 	}
@@ -1276,5 +1277,5 @@ function responsive_update_utility_menu( int $menu_id, $menu_data = array() ) {
  * Add message that Utility Menu Items have been deleted.
  */
 function responsive_utility_menu_items_deleted_notice() {
- 	echo '<div class="notice notice-error is-dismissible">Nested Utility Menu Items not allowed. All menu items reset to the the top level.</div>';
+	echo '<div class="notice notice-error is-dismissible">' . esc_html__( 'Nested Utility Menu Items not allowed. All menu items reset to the the top level.', 'responsive-framework' ) . '</div>';
 }

From b657a43dd8e236b0aa1681b3dc02ab397849ff4f Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 19 Oct 2021 10:48:04 -0400
Subject: [PATCH 12/13] build

---
 languages/responsive-framework.pot | 48 ++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 16 deletions(-)

diff --git a/languages/responsive-framework.pot b/languages/responsive-framework.pot
index c464d902..86a30c2d 100644
--- a/languages/responsive-framework.pot
+++ b/languages/responsive-framework.pot
@@ -5,7 +5,7 @@ msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: "
 "https://wordpress.org/support/theme/responsive-framework-2-x\n"
-"POT-Creation-Date: 2021-09-24 14:58:57+00:00\n"
+"POT-Creation-Date: 2021-10-19 14:47:41+00:00\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -231,7 +231,7 @@ msgid ""
 "2 widgets will appear."
 msgstr ""
 
-#: functions.php:267 inc/template-tags.php:1069
+#: functions.php:267 inc/template-tags.php:1070
 msgid "Footbar"
 msgstr ""
 
@@ -239,7 +239,7 @@ msgstr ""
 msgid "Add widgets here to appear in your footer."
 msgstr ""
 
-#: functions.php:281 inc/template-tags.php:1070
+#: functions.php:281 inc/template-tags.php:1071
 msgid "Alternate Footbar"
 msgstr ""
 
@@ -456,63 +456,79 @@ msgstr ""
 msgid "Profile Directory"
 msgstr ""
 
-#: inc/template-tags.php:467 template-parts/masthead-side-nav.php:20
+#: inc/template-tags.php:468 template-parts/masthead-side-nav.php:20
 #: template-parts/masthead-top-nav.php:10 template-parts/masthead.php:15
 msgid "Open menu"
 msgstr ""
 
-#: inc/template-tags.php:468
+#: inc/template-tags.php:469
 msgid "Full Menu"
 msgstr ""
 
-#: inc/template-tags.php:469
+#: inc/template-tags.php:470
 msgid "Close Menu"
 msgstr ""
 
-#: inc/template-tags.php:651
+#: inc/template-tags.php:652
 #. translators: %s: archive type singular name.
 msgid "%s navigation"
 msgstr ""
 
-#: inc/template-tags.php:656
+#: inc/template-tags.php:657
 msgid "Newer posts"
 msgstr ""
 
-#: inc/template-tags.php:657
+#: inc/template-tags.php:658
 msgid "Older posts"
 msgstr ""
 
-#: inc/template-tags.php:698
+#: inc/template-tags.php:699
 msgid "Post navigation"
 msgstr ""
 
-#: inc/template-tags.php:726 single.php:49
+#: inc/template-tags.php:727 single.php:49
 #. translators: %s: author name linking to their archive page.
 #. translators: %s: author name
 msgid "<em>By </em>%s"
 msgstr ""
 
-#: inc/template-tags.php:743
+#: inc/template-tags.php:744
 #. translators: %s: category list for the post.
 msgid "<em>in</em> %s"
 msgstr ""
 
-#: inc/template-tags.php:752
+#: inc/template-tags.php:753
 msgid "<strong>0</strong> comments"
 msgstr ""
 
-#: inc/template-tags.php:752
+#: inc/template-tags.php:753
 msgid "<strong>1</strong> comment"
 msgstr ""
 
-#: inc/template-tags.php:752
+#: inc/template-tags.php:753
 msgid "<strong>%</strong> comments"
 msgstr ""
 
-#: inc/template-tags.php:897
+#: inc/template-tags.php:898
 msgid "View all posts"
 msgstr ""
 
+#: inc/template-tags.php:1232
+msgid "The Utility Menu only displays the top level items."
+msgstr ""
+
+#: inc/template-tags.php:1234
+msgid ""
+"More items may display in the Menu Structure but those items will be reset "
+"to the top level on save."
+msgstr ""
+
+#: inc/template-tags.php:1280
+msgid ""
+"Nested Utility Menu Items not allowed. All menu items reset to the the top "
+"level."
+msgstr ""
+
 #: no-access-bumc.php:13
 msgid "Access Restricted To BUMC/BMC"
 msgstr ""

From 63b9059a289839617239c56131c00b656cbe70af Mon Sep 17 00:00:00 2001
From: Alana Martin <stonybrookweb@gmail.com>
Date: Tue, 19 Oct 2021 11:50:46 -0400
Subject: [PATCH 13/13] no message

---
 inc/template-tags.php              | 2 +-
 languages/responsive-framework.pot | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/inc/template-tags.php b/inc/template-tags.php
index 2246b569..b8389ee1 100755
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -1231,7 +1231,7 @@ function responsive_utility_menu_notice() {
 	if ( $nav_menu_selected_id === $utility_menu->term_id ) {
 		$notice  = __( 'The Utility Menu only displays the top level items.', 'responsive-framework' );
 		$notice .= '<br>';
-		$notice .= __( 'More items may display in the Menu Structure but those items will be reset to the top level on save.', 'responsive-framework' );
+		$notice .= __( 'Nested items are prevented and/or reset to the top level on save.', 'responsive-framework' );
 		echo '<div class="notice notice-warning">' . wp_kses_post( $notice ) . '</div>';
 	}
 }
diff --git a/languages/responsive-framework.pot b/languages/responsive-framework.pot
index 86a30c2d..31af2562 100644
--- a/languages/responsive-framework.pot
+++ b/languages/responsive-framework.pot
@@ -5,7 +5,7 @@ msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: "
 "https://wordpress.org/support/theme/responsive-framework-2-x\n"
-"POT-Creation-Date: 2021-10-19 14:47:41+00:00\n"
+"POT-Creation-Date: 2021-10-19 15:48:45+00:00\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -518,9 +518,7 @@ msgid "The Utility Menu only displays the top level items."
 msgstr ""
 
 #: inc/template-tags.php:1234
-msgid ""
-"More items may display in the Menu Structure but those items will be reset "
-"to the top level on save."
+msgid "Nested items are prevented and/or reset to the top level on save."
 msgstr ""
 
 #: inc/template-tags.php:1280