<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13331] trunk: Nav cleanup.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13331">13331</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-23 17:13:24 +0000 (Tue, 23 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Nav cleanup. see <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincustomnavigationphp">trunk/wp-admin/custom-navigation.php</a></li>
<li><a href="#trunkwpincludescustomnavigationphp">trunk/wp-includes/custom-navigation.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincustomnavigationphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/custom-navigation.php (13330 => 13331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/custom-navigation.php        2010-02-23 11:14:35 UTC (rev 13330)
+++ trunk/wp-admin/custom-navigation.php        2010-02-23 17:13:24 UTC (rev 13331)
</span><span class="lines">@@ -176,23 +176,20 @@
</span><span class="cx">                 $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been updated.') . '&lt;/p&gt;&lt;/div&gt;';
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-                 //DISPLAY Custom Navigation
</del><ins>+                 // DISPLAY Custom Navigation
</ins><span class="cx">                  ?&gt;
</span><span class="cx">                 &lt;div id=&quot;pages-left&quot;&gt;
</span><span class="cx">                         &lt;div class=&quot;inside&quot;&gt;
</span><span class="cx">                         &lt;h2 class=&quot;maintitle&quot;&gt;&lt;?php esc_html_e('Custom Navigation') ?&gt;&lt;/h2&gt;
</span><span class="cx">                         &lt;?php
</span><span class="cx"> 
</span><del>-                                //CHECK if custom menu has been enabled
</del><ins>+                                // CHECK if custom menu has been enabled
</ins><span class="cx">                                 $enabled_menu = get_option('wp_custom_nav_menu');
</span><span class="cx">                             $checked = strtolower($enabled_menu);
</span><span class="cx"> 
</span><del>-                                if ($checked == 'true') {
-                                } else {
</del><ins>+                                if ( $checked != 'true' )
</ins><span class="cx">                                         echo '&lt;div id=&quot;message-enabled&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __('The Custom Menu has not been Enabled yet. Please enable it in order to use it --------&gt;') . '&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;';
</span><del>-                                }
</del><span class="cx"> 
</span><del>-
</del><span class="cx">                         ?&gt;
</span><span class="cx">                         &lt;?php echo $messagesdiv; ?&gt;
</span><span class="cx">                         &lt;form onsubmit=&quot;updatepostdata()&quot; action=&quot;custom-navigation.php&quot; method=&quot;post&quot;  enctype=&quot;multipart/form-data&quot;&gt;
</span><span class="lines">@@ -215,9 +212,9 @@
</span><span class="cx">                         &lt;?php
</span><span class="cx">                         //DISPLAY existing menu
</span><span class="cx">                         if ( $menu_selected_id &gt; 0 ) {
</span><del>-                                //SET output type
</del><ins>+                                // SET output type
</ins><span class="cx">                                 $output_type = &quot;backend&quot;;
</span><del>-                                //MAIN OUTPUT FUNCTION
</del><ins>+                                // MAIN OUTPUT FUNCTION
</ins><span class="cx">                                 wp_custom_navigation_output( 'type='.$output_type.'&amp;name='.$menu_title.'&amp;id='.$menu_selected_id );
</span><span class="cx">                         }
</span><span class="cx">                         ?&gt;
</span><span class="lines">@@ -248,7 +245,7 @@
</span><span class="cx"> 
</span><span class="cx">                                         &lt;?php
</span><span class="cx"> 
</span><del>-                                    //SETUP Custom Menu
</del><ins>+                                    // Setup custom menu
</ins><span class="cx"> 
</span><span class="cx">                                         $enabled_menu = get_option('wp_custom_nav_menu');
</span><span class="cx"> 
</span><span class="lines">@@ -281,7 +278,7 @@
</span><span class="cx">                                         &lt;select id=&quot;menu_select&quot; name=&quot;menu_select&quot;&gt;
</span><span class="cx">                                                 &lt;?php
</span><span class="cx"> 
</span><del>-                                                //DISPLAY SELECT OPTIONS
</del><ins>+                                                // Display select options
</ins><span class="cx">                                                 foreach ( $custom_menus as $menu ) {
</span><span class="cx">                                                         $menu_term = get_term( $menu, 'nav_menu' );
</span><span class="cx">                                                         if ( ( $menu_id_in_edit == $menu-&gt;term_id ) || ( $menu_selected_id == $menu-&gt;term_id ) )
</span><span class="lines">@@ -314,16 +311,12 @@
</span><span class="cx"> 
</span><span class="cx">                                         &lt;?php
</span><span class="cx"> 
</span><del>-                                    //UPDATE and DISPLAY Menu Description Option
</del><ins>+                                    // UPDATE and DISPLAY Menu Description Option
</ins><span class="cx">                                     if ( isset($_POST['menu-descriptions']) ) {
</span><del>-
-                                                if ( isset($_POST['switch_menu']) ) {
-
-                                                } else {
</del><ins>+                                                if ( !isset($_POST['switch_menu']) ) {
</ins><span class="cx">                                                         $menu_options_to_edit = $_POST['menu_id_in_edit'];
</span><span class="cx">                                                     update_option('wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);
</span><span class="cx">                                                 }
</span><del>-
</del><span class="cx">                                     }
</span><span class="cx"> 
</span><span class="cx">                                     if ( $menu_id_in_edit &gt; 0 )
</span><span class="lines">@@ -381,7 +374,7 @@
</span><span class="cx">                                                         $page_name .= htmlentities($post-&gt;post_title).'|';
</span><span class="cx">                                                 }
</span><span class="cx">                                         } else {
</span><del>-                                                $page_name = &quot;No pages available&quot;;
</del><ins>+                                                $page_name = __('No pages available');
</ins><span class="cx">                                         }
</span><span class="cx"> 
</span><span class="cx">                                         ?&gt;
</span><span class="lines">@@ -448,7 +441,7 @@
</span><span class="cx">                                         $cat_name = '';
</span><span class="cx">                                         //CHECK for results
</span><span class="cx">                                         if ( $categories ) {
</span><del>-                                                foreach( $categories as $category ) {
</del><ins>+                                                foreach ( $categories as $category ) {
</ins><span class="cx">                                                         $cat_id = $category-&gt;term_id;
</span><span class="cx"> 
</span><span class="cx">                                                         $cat_args = array(
</span><span class="lines">@@ -507,8 +500,8 @@
</span><span class="cx"> 
</span><span class="cx">                                         &lt;ul id=&quot;existing-categories&quot; class=&quot;list&quot;&gt;
</span><span class="cx">                                     &lt;?php
</span><del>-                                                         //Get default Categories
-                                            $intCounter = wp_custom_nav_get_categories($intCounter,'default');
</del><ins>+                                                         // Get default Categories
+                                            $intCounter = wp_custom_nav_get_categories($intCounter, 'default');
</ins><span class="cx">                                                 ?&gt;
</span><span class="cx">                                        &lt;/ul&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -557,7 +550,6 @@
</span><span class="cx">         &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;?php
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> include(&quot;admin-footer.php&quot;);
</span></span></pre></div>
<a id="trunkwpincludescustomnavigationphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/custom-navigation.php (13330 => 13331)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/custom-navigation.php        2010-02-23 11:14:35 UTC (rev 13330)
+++ trunk/wp-includes/custom-navigation.php        2010-02-23 17:13:24 UTC (rev 13331)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function wp_custom_navigation_setup($override = false) {
</span><del>-
</del><span class="cx">         // Custom Navigation Menu Setup
</span><span class="cx"> 
</span><span class="cx">         // Override for menu descriptions
</span><span class="lines">@@ -44,6 +43,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> function wp_custom_navigation_delete_menu( $menu_term_id ) {
</span><span class="cx">         $term_id = (int) $menu_term_id;
</span><span class="cx">         if ( $term_id &gt; 0 ) {
</span><span class="lines">@@ -57,10 +57,100 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function setup_menu_item($menu_item) {
+        global $parent_menu_order;
+
+        $menu_item-&gt;type = get_post_meta($menu_item-&gt;ID, 'menu_type', true);
+        $menu_item-&gt;object_id = get_post_meta($menu_item-&gt;ID, 'object_id', true);
+        //$parent_menu_order[ $menu_item-&gt;ID ] = $menu_item-&gt;menu_order;
+        if ( isset( $parent_menu_order[ $menu_item-&gt;post_parent ] ) )
+                $menu_item-&gt;parent_item = $parent_menu_order[ $menu_item-&gt;post_parent ];
+        else
+                $menu_item-&gt;parent_item = 0;
+
+        switch ( $menu_item-&gt;type ) {
+                // Page Menu Item
+                case 'page':
+                        if ( $menu_item-&gt;guid == '' )
+                                $menu_item-&gt;link = get_permalink( $menu_item-&gt;object_id );
+                        else
+                                $menu_item-&gt;link = $menu_item-&gt;guid;
+
+                        if ( $menu_item-&gt;post_title == '' )
+                                $menu_item-&gt;title = htmlentities( get_the_title( $menu_item-&gt;object_id ) );
+                        else
+                                $menu_item-&gt;title = htmlentities( $menu_item-&gt;post_title );
+
+                        if ( $menu_item-&gt;post_content == '' )
+                                $menu_item-&gt;description = htmlentities( get_post_meta( $menu_item-&gt;ID, 'page-description', true ) );
+                        else
+                                $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
+                        $menu_item-&gt;target = '';
+                break;
+                // Category Menu Item
+                case 'category':
+                        if ( $menu_item-&gt;guid == '' )
+                                $menu_item-&gt;link = get_category_link( $menu_item-&gt;object_id );
+                        else
+                                $menu_item-&gt;link = $menu_item-&gt;guid;
+
+                        if ( $menu_item-&gt;post_title == '' ) {
+                                $title_raw = get_categories( array('include' =&gt; $menu_item-&gt;object_id) );
+                                $menu_item-&gt;title =  htmlentities($title_raw[0]-&gt;cat_name);
+                        } else {
+                                $menu_item-&gt;title = htmlentities( $menu_item-&gt;post_title );
+                        }
+
+                        if ( $menu_item-&gt;post_content == '' )
+                                $menu_item-&gt;description = htmlentities( strip_tags( category_description( $menu_item-&gt;object_id ) ) );
+                        else
+                                $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
+                        $menu_item-&gt;target = '';
+                break;
+                default:
+                        // Custom Menu Item
+                        $menu_item-&gt;link = $menu_item-&gt;guid;
+                        $menu_item-&gt;title =  htmlentities( $menu_item-&gt;post_title );
+                        $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
+                        $menu_item-&gt;target = 'target=&quot;_blank&quot;';
+                break;
+        }
+
+        $menu_item-&gt;li_class = '';
+        global $wp_query;
+        if ( $menu_item-&gt;ID == $wp_query-&gt;get_queried_object_id() )
+                $menu_item-&gt;li_class = 'class=&quot;current_page_item&quot;';
+
+/* @todo: update to use tax/post data
+
+                        //SET anchor title
+                        if (isset($wp_custom_nav_menu_items-&gt;custom_anchor_title)) {
+                                $anchor_title = htmlentities($wp_custom_nav_menu_items-&gt;custom_anchor_title);
+                        }
+                        else {
+                                $anchor_title = $title;
+                        }
+
+                        if ($queried_id == $wp_custom_nav_menu_items-&gt;post_id) {
+                                $li_class = 'class=&quot;current_page_item&quot;';
+                        }
+
+                        if (isset($wp_custom_nav_menu_items-&gt;new_window)) {
+                                if ($wp_custom_nav_menu_items-&gt;new_window &gt; 0) {
+                                        $target = 'target=&quot;_blank&quot;';
+                                }
+                                else {
+                                        $target = '';
+                                }
+                        }
+*/
+
+        return $menu_item;
+}
+
</ins><span class="cx"> /*-----------------------------------------------------------------------------------*/
</span><span class="cx"> /* Custom Navigation Functions */
</span><span class="cx"> /* wp_custom_navigation_output() displays the menu in the back/frontend
</span><del>-/* wp_custom_navigation_sub_items() is a recursive sub menu item function
</del><span class="cx"> /* wp_custom_nav_get_pages()
</span><span class="cx"> /* wp_custom_nav_get_categories()
</span><span class="cx"> /* wp_custom_navigation_default_sub_items() is a recursive sub menu item function
</span><span class="lines">@@ -76,9 +166,7 @@
</span><span class="cx"> /* before_title - html before title is outputted in &lt;a&gt; tag
</span><span class="cx"> /* after_title - html after title is outputted in &lt;a&gt; tag
</span><span class="cx"> /*-----------------------------------------------------------------------------------*/
</span><del>-
</del><span class="cx"> function wp_custom_navigation_output( $args = array() ) {
</span><del>-
</del><span class="cx">                 // Defaults
</span><span class="cx">                 $defaults = array( 'type' =&gt; 'frontend', 'name' =&gt; 'Menu 1', 'id' =&gt; 0, 'desc' =&gt; 2, 'before_title' =&gt; '', 'after_title' =&gt; '');
</span><span class="cx"> 
</span><span class="lines">@@ -87,139 +175,57 @@
</span><span class="cx"> 
</span><span class="cx">                 $menu_objects = get_objects_in_term( $id, 'nav_menu' );
</span><span class="cx">                 $menu_items = wp_custom_navigation_get_menu_items( $menu_objects, 'menu_order' );
</span><del>-                //O verride for menu descriptions
</del><ins>+                // Override for menu descriptions
</ins><span class="cx">                 $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
</span><span class="cx">                 if ( $advanced_option_descriptions == 'no' )
</span><span class="cx">                         $desc = 2;
</span><span class="cx"> 
</span><del>-                $queried_id = 0;
-                global $wp_query;
-                if ( is_page() )
-                        $queried_id = $wp_query-&gt;get_queried_object_id();
-                elseif ( is_category() )
-                        $queried_id = $wp_query-&gt;get_queried_object_id();
-
</del><span class="cx">                 $parent_stack = array();
</span><span class="cx">                 $current_parent = 0;
</span><span class="cx">                 $parent_menu_order = array();
</span><del>-            // Display Loop
</del><ins>+                // Setup parentage
</ins><span class="cx">                 foreach ( $menu_items as $key =&gt; $menu_item ) {
</span><del>-                        $menu_type = get_post_meta($menu_item-&gt;ID, 'menu_type', true);
-                        $object_id = get_post_meta($menu_item-&gt;ID, 'object_id', true);
</del><span class="cx">                         $parent_menu_order[ $menu_item-&gt;ID ] = $menu_item-&gt;menu_order;
</span><del>-                        if ( isset( $parent_menu_order[ $menu_item-&gt;post_parent ] ) )
-                                $parent_item = $parent_menu_order[ $menu_item-&gt;post_parent ];
-                        else
-                                $parent_item = 0;
</del><ins>+                }
</ins><span class="cx"> 
</span><del>-                        switch ( $menu_type ) {
-                                // Page Menu Item
-                                case 'page':
-                                        if ( $menu_item-&gt;guid == '' )
-                                                $link = get_permalink( $object_id );
-                                        else
-                                                $link = $menu_item-&gt;guid;
-
-                                        if ( $menu_item-&gt;post_title == '' )
-                                                $title = htmlentities( get_the_title( $object_id ) );
-                                        else
-                                                $title = htmlentities( $menu_item-&gt;post_title );
-
-                                        if ( $menu_item-&gt;post_content == '' )
-                                                $description = htmlentities( get_post_meta( $menu_item-&gt;ID, 'page-description', true ) );
-                                        else
-                                                $description = htmlentities( $menu_item-&gt;post_content );
-                                        $target = '';
-                                break;
-                                // Category Menu Item
-                                case 'category':
-                                        if ( $menu_item-&gt;guid == '' )
-                                                $link = get_category_link( $object_id );
-                                        else
-                                                $link = $menu_item-&gt;guid;
-
-                                        if ( $menu_item-&gt;post_title == '' ) {
-                                                $title_raw = get_categories( array('include' =&gt; $object_id) );
-                                                $title =  htmlentities($title_raw[0]-&gt;cat_name);
-                                        } else {
-                                                $title = htmlentities( $menu_item-&gt;post_title );
-                                        }
-
-                                        if ( $menu_item-&gt;post_content == '' )
-                                                $description = htmlentities( strip_tags( category_description( $object_id ) ) );
-                                        else
-                                                $description = htmlentities( $menu_item-&gt;post_content );
-                                        $target = '';
-                                break;
-                                default:
-                                        // Custom Menu Item
-                                        $link = $menu_item-&gt;guid;
-                                        $title =  htmlentities( $menu_item-&gt;post_title );
-                                        $description = htmlentities( $menu_item-&gt;post_content );
-                                        $target = 'target=&quot;_blank&quot;';
-                                break;
-                        }
-
-                        $li_class = '';
-/* @todo: update to use tax/post data
-
-                        //SET anchor title
-                        if (isset($wp_custom_nav_menu_items-&gt;custom_anchor_title)) {
-                                $anchor_title = htmlentities($wp_custom_nav_menu_items-&gt;custom_anchor_title);
-                        }
-                        else {
-                                $anchor_title = $title;
-                        }
-
-                        if ($queried_id == $wp_custom_nav_menu_items-&gt;post_id) {
-                                $li_class = 'class=&quot;current_page_item&quot;';
-                        }
-
-                        if (isset($wp_custom_nav_menu_items-&gt;new_window)) {
-                                if ($wp_custom_nav_menu_items-&gt;new_window &gt; 0) {
-                                        $target = 'target=&quot;_blank&quot;';
-                                }
-                                else {
-                                        $target = '';
-                                }
-                        }
-*/
</del><ins>+            // Display Loop
+                foreach ( $menu_items as $key =&gt; $menu_item ) {
+                        $menu_item = setup_menu_item($menu_item);
</ins><span class="cx">                         // List Items
</span><del>-                        ?&gt;&lt;li id=&quot;menu-&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; &lt;?php echo $li_class; ?&gt;&gt;&lt;?php
</del><ins>+                        ?&gt;&lt;li id=&quot;menu-&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; &lt;?php echo $menu_item-&gt;li_class; ?&gt;&gt;&lt;?php
</ins><span class="cx">                                         //@todo: update front end to use post data
</span><span class="cx">                                         //FRONTEND Link
</span><span class="cx">                                         if ( $type == 'frontend' ) {
</span><del>-                                                ?&gt;&lt;a title=&quot;&lt;?php echo $anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $link; ?&gt;&quot; &lt;?php echo $target; ?&gt;&gt;&lt;?php echo $before_title.$title.$after_title; ?&gt;&lt;?php
</del><ins>+                                                ?&gt;&lt;a title=&quot;&lt;?php echo $menu_item-&gt;anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; &lt;?php echo $menu_item-&gt;target; ?&gt;&gt;&lt;?php echo $before_title.$menu_item-&gt;title.$after_title; ?&gt;&lt;?php
</ins><span class="cx"> 
</span><span class="cx">                                                         if ( $advanced_option_descriptions == 'no' ) {
</span><span class="cx">                                                                 // 2 widget override do NOT display descriptions
</span><span class="cx">                                                                 // 1 widget override display descriptions
</span><span class="cx">                                                                 // 0 widget override not set
</span><span class="cx">                                                                 if ( ($desc == 1) || ($desc == 0) ) {
</span><del>-                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $description; ?&gt;&lt;/span&gt;&lt;?php
</del><ins>+                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
</ins><span class="cx">                                                                 }
</span><span class="cx">                                                         } else {
</span><span class="cx">                                                                 // 2 widget override do NOT display descriptions
</span><span class="cx">                                                                 // 1 widget override display descriptions
</span><span class="cx">                                                                 // 0 widget override not set
</span><span class="cx">                                                                 if ( $desc == 1 ) {
</span><del>-                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $description; ?&gt;&lt;/span&gt;&lt;?php
</del><ins>+                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
</ins><span class="cx">                                                                 }
</span><span class="cx">                                                         }
</span><span class="cx"> 
</span><span class="cx">                                                 ?&gt;&lt;/a&gt;&lt;?php
</span><span class="cx">                                         } elseif ( $type == 'backend' ) {
</span><del>-                                                $link_type = $menu_type;
</del><span class="cx">                                                 ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                                 &lt;dl&gt;
</span><span class="cx">                                                         &lt;dt&gt;
</span><del>-                                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/span&gt;
</del><ins>+                                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo $menu_item-&gt;title; ?&gt;&lt;/span&gt;
</ins><span class="cx">                                                                 &lt;span class=&quot;controls&quot;&gt;
</span><del>-                                                                &lt;span class=&quot;type&quot;&gt;&lt;?php echo $link_type; ?&gt;&lt;/span&gt;
-                                                                &lt;a id=&quot;edit&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-edit.png&quot; /&gt;&lt;/a&gt;
-                                                                &lt;a id=&quot;remove&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-close.png&quot; /&gt;&lt;/a&gt;
-                                                                &lt;a id=&quot;view&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; target=&quot;_blank&quot; href=&quot;&lt;?php echo $link; ?&gt;&quot;&gt;&lt;img alt=&quot;View Page&quot; title=&quot;View Page&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-viewpage.png&quot; /&gt;&lt;/a&gt;
</del><ins>+                                                                &lt;span class=&quot;type&quot;&gt;&lt;?php echo $menu_item-&gt;type; ?&gt;&lt;/span&gt;
+                                                                &lt;a id=&quot;edit&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;&lt;?php echo admin_url('images/ico-edit.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
+                                                                &lt;a id=&quot;remove&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;&lt;?php echo admin_url('images/ico-close.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
+                                                                &lt;a id=&quot;view&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; target=&quot;_blank&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;img alt=&quot;View Page&quot; title=&quot;View Page&quot; src=&quot;&lt;?php echo admin_url('images/ico-viewpage.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
</ins><span class="cx">                                                                 &lt;/span&gt;
</span><span class="cx">                                                         &lt;/dt&gt;
</span><span class="cx">                                                 &lt;/dl&gt;
</span><span class="lines">@@ -227,13 +233,13 @@
</span><span class="cx">                                                 &lt;a&gt;&lt;span class=&quot;&quot;&gt;&lt;/span&gt;&lt;/a&gt;
</span><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;dbid&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;dbid&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; /&gt;
</span><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;postmenu&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;postmenu&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $id; ?&gt;&quot; /&gt;
</span><del>-                                                &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $parent_item; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $link; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $description; ?&gt;&quot; /&gt;
</del><ins>+                                                &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;parent_item; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;title; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;description; ?&gt;&quot; /&gt;
</ins><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;icon&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;icon&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;0&quot; /&gt;
</span><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;position&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;position&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; /&gt;
</span><del>-                                                &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $link_type; ?&gt;&quot; /&gt;
</del><ins>+                                                &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;type; ?&gt;&quot; /&gt;
</ins><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;anchortitle&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;anchortitle&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo esc_html( $menu_item-&gt;post_excerpt ); ?&gt;&quot; /&gt;
</span><span class="cx">                                                 &lt;input type=&quot;hidden&quot; name=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo ( '' == $menu_item-&gt;post_content_filtered ? '0' : '1' ); ?&gt;&quot; /&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -259,187 +265,7 @@
</span><span class="cx"> &lt;?php                        }
</span><span class="cx">         }                
</span><span class="cx"> }
</span><del>-//@todo: implement menu heirarchy
-//RECURSIVE Sub Menu Items
-function wp_custom_navigation_sub_items($post_id, $type, $table_name, $output_type, $menu_id = 0) {
</del><span class="cx"> 
</span><del>-        $parent_id = 0;
-        global $wpdb;
-
-        //GET sub menu items
-        $wp_custom_nav_menu = $wpdb-&gt;get_results(&quot;SELECT id,post_id,parent_id,position,custom_title,custom_link,custom_description,menu_icon,link_type,custom_anchor_title,new_window FROM &quot;.$table_name.&quot; WHERE parent_id = '&quot;.$post_id.&quot;' AND menu_id='&quot;.$menu_id.&quot;' ORDER BY position ASC&quot;);
-
-        if (empty($wp_custom_nav_menu))
-        {
-
-        }
-        else
-        {
-                ?&gt;&lt;ul id=&quot;sub-custom-nav&quot;&gt;
-                &lt;?php
-            $queried_id = 0;
-                global $wp_query;
-        if (is_page()) {
-                    $queried_id = $wp_query-&gt;post-&gt;ID;
-            }
-            elseif (is_category()) {
-                    $queried_id = $wp_query-&gt;query_vars['cat'];
-            }
-            else {
-
-            }
-            //DISPLAY Loop
-                foreach ($wp_custom_nav_menu as $sub_item)
-                {
-                        //Figure out where the menu item sits
-                        $counter=$sub_item-&gt;position;
-
-                        //Prepare Menu Data
-                        //Category Menu Item
-                        if ($sub_item-&gt;link_type == 'category')
-                        {
-
-                                $parent_id = $sub_item-&gt;parent_id;
-                                $post_id = $sub_item-&gt;post_id;
-
-                                if ($sub_item-&gt;custom_link == '') {
-                                        $link = get_category_link($sub_item-&gt;post_id);
-                                }
-                                else {
-                                        $link = $sub_item-&gt;custom_link;
-                                }
-
-                                if ($sub_item-&gt;custom_title == '') {
-                                        $title_raw = get_categories('include='.$sub_item-&gt;post_id);
-                                        $title =  htmlentities($title_raw[0]-&gt;cat_name);
-                                }
-                                else {
-                                        $title = htmlentities($sub_item-&gt;custom_title);
-                                }
-
-                                if ($sub_item-&gt;custom_description == '') {
-                                        $description = strip_tags(category_description($sub_item-&gt;post_id));
-                                }
-                                else {
-                                        $description = $sub_item-&gt;custom_description;
-                                }
-                                $target = '';
-                        }
-                        //Page Menu Item
-                        elseif ($sub_item-&gt;link_type == 'page')
-                        {
-
-                                $parent_id = $sub_item-&gt;parent_id;
-                                $post_id = $sub_item-&gt;post_id;
-
-                                if ($sub_item-&gt;custom_link == '') {
-                                        $link = get_permalink($sub_item-&gt;post_id);
-                                }
-                                else {
-                                        $link = $sub_item-&gt;custom_link;
-                                }
-
-                                if ($sub_item-&gt;custom_title == '') {
-                                        $title = htmlentities(get_the_title($sub_item-&gt;post_id));
-                                }
-                                else {
-                                        $title = htmlentities($sub_item-&gt;custom_title);
-                                }
-
-                                if ($sub_item-&gt;custom_description == '') {
-                                        $description = get_post_meta($sub_item-&gt;post_id, 'page-description', true);
-                                }
-                                else {
-                                        $description = $sub_item-&gt;custom_description;
-                                }
-                                $target = '';
-
-                        }
-                        //Custom Menu Item
-                        else
-                        {
-                                $link = $sub_item-&gt;custom_link;
-                                $title = htmlentities($sub_item-&gt;custom_title);
-                                $parent_id = $sub_item-&gt;parent_id;
-                                $post_id = $sub_item-&gt;post_id;
-                                $description = $sub_item-&gt;custom_description;
-                                $target = 'target=&quot;_blank&quot;';
-                        }
-                        if ($queried_id == $sub_item-&gt;post_id) {
-                                $li_class = 'class=&quot;current_page_item&quot;';
-                        }
-                        else {
-                                $li_class = '';
-                        }
-
-                        //SET anchor title
-                        if (isset($sub_item-&gt;custom_anchor_title)) {
-                                $anchor_title = htmlentities($sub_item-&gt;custom_anchor_title);
-                        }
-                        else {
-                                $anchor_title = $title;
-                        }
-
-                        if (isset($sub_item-&gt;new_window)) {
-                                if ($sub_item-&gt;new_window &gt; 0) {
-                                        $target = 'target=&quot;_blank&quot;';
-                                }
-                        }
-
-                        //List Items
-                        ?&gt;&lt;li id=&quot;menu-&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot; &lt;?php echo $li_class; ?&gt;&gt;&lt;?php
-                                                //FRONTEND
-                                                if ($output_type == &quot;frontend&quot;)
-                                                {
-                                                        ?&gt;&lt;a title=&quot;&lt;?php echo $anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $link; ?&gt;&quot; &lt;?php echo $target; ?&gt;&gt;&lt;?php echo $title; ?&gt;&lt;/a&gt;&lt;?php
-                                                }
-                                                //BACKEND
-                                                elseif ($output_type == &quot;backend&quot;)
-                                                {
-                                                        ?&gt;
-                                                        &lt;dl&gt;
-                                                        &lt;dt&gt;
-                                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/span&gt;
-                                                                &lt;span class=&quot;controls&quot;&gt;
-                                                                &lt;span class=&quot;type&quot;&gt;&lt;?php echo $sub_item-&gt;link_type; ?&gt;&lt;/span&gt;
-                                                                &lt;a id=&quot;edit&lt;?php echo $counter; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $counter; ?&gt;)&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-edit.png&quot; /&gt;&lt;/a&gt;
-                                                                &lt;a id=&quot;remove&lt;?php echo $counter; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $counter; ?&gt;)&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-close.png&quot; /&gt;&lt;/a&gt;
-                                                                &lt;a id=&quot;view&lt;?php echo $counter; ?&gt;&quot; target=&quot;_blank&quot; href=&quot;&lt;?php echo $link; ?&gt;&quot;&gt;&lt;img alt=&quot;View Page&quot; title=&quot;View Page&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-viewpage.png&quot; /&gt;&lt;/a&gt;
-                                                                &lt;/span&gt;
-                                                        &lt;/dt&gt;
-                                                        &lt;/dl&gt;
-                                                        &lt;a class=&quot;hide&quot; href=&quot;&lt;?php echo $link; ?&gt;&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/a&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;dbid&lt;?php echo $counter; ?&gt;&quot; id=&quot;dbid&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $sub_item-&gt;id; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;postmenu&lt;?php echo $counter; ?&gt;&quot; id=&quot;postmenu&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $post_id; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo $counter; ?&gt;&quot; id=&quot;parent&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $parent_id; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $counter; ?&gt;&quot; id=&quot;title&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $counter; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $link; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $counter; ?&gt;&quot; id=&quot;description&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $description; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;icon&lt;?php echo $counter; ?&gt;&quot; id=&quot;icon&lt;?php echo $counter; ?&gt;&quot; value=&quot;0&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;position&lt;?php echo $counter; ?&gt;&quot; id=&quot;position&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo $counter; ?&gt;&quot; id=&quot;linktype&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $sub_item-&gt;link_type; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;anchortitle&lt;?php echo $counter; ?&gt;&quot; id=&quot;anchortitle&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $anchor_title; ?&gt;&quot; /&gt;
-                                                        &lt;input type=&quot;hidden&quot; name=&quot;newwindow&lt;?php echo $counter; ?&gt;&quot; id=&quot;newwindow&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $sub_item-&gt;new_window; ?&gt;&quot; /&gt;
-                                                        &lt;?php
-                                                }
-
-                                                //Do recursion
-                                                wp_custom_navigation_sub_items($sub_item-&gt;id,$sub_item-&gt;link_type,$table_name,$output_type,$menu_id);
-                        ?&gt;&lt;/li&gt;
-                        &lt;?php
-
-                }
-
-        ?&gt;&lt;/ul&gt;
-        &lt;?php
-
-        }
-
-        return $parent_id;
-
-}
-
-
</del><span class="cx"> // Outputs All Pages and Sub Items
</span><span class="cx"> function wp_custom_nav_get_pages($counter, $type) {
</span><span class="cx"> 
</span><span class="lines">@@ -561,7 +387,7 @@
</span><span class="cx">         return $intCounter;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-//Outputs All Categories and Sub Items
</del><ins>+// Outputs All Categories and Sub Items
</ins><span class="cx"> function wp_custom_nav_get_categories($counter, $type) {
</span><span class="cx"> 
</span><span class="cx">         $category_args = array(
</span><span class="lines">@@ -589,7 +415,6 @@
</span><span class="cx"> 
</span><span class="cx">         // Display Loop
</span><span class="cx">         foreach ( $categories_array as $cat_item ) {
</span><del>-
</del><span class="cx">                 if ( $cat_item-&gt;parent == 0 ) {
</span><span class="cx">                         // Custom Menu
</span><span class="cx">                         if ( $type == 'menu' ) {
</span><span class="lines">@@ -598,15 +423,15 @@
</span><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
</span><span class="cx">                                         &lt;dl&gt;
</span><span class="cx">                                         &lt;dt&gt;
</span><del>-                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo $cat_item-&gt;cat_name; ?&gt;&lt;/span&gt;
</del><ins>+                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo esc_html($cat_item-&gt;cat_name); ?&gt;&lt;/span&gt;
</ins><span class="cx">                                                 &lt;span class=&quot;controls&quot;&gt;
</span><span class="cx">                                                 &lt;span class=&quot;type&quot;&gt;category&lt;/span&gt;
</span><del>-                                                &lt;a id=&quot;edit&lt;?php echo $intCounter; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $intCounter; ?&gt;)&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-edit.png&quot; /&gt;&lt;/a&gt;
</del><ins>+                                                &lt;a id=&quot;edit&lt;?php echo $intCounter; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $intCounter; ?&gt;)&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; title=&quot;=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-edit.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
</ins><span class="cx">                                                 &lt;a id=&quot;remove&lt;?php echo $intCounter; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $intCounter; ?&gt;)&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
</span><del>-                                                        &lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-close.png&quot; /&gt;
</del><ins>+                                                        &lt;img class=&quot;remove&quot; alt=&quot;=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; title=&quot;=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-close.png'); ?&gt;&quot; /&gt;
</ins><span class="cx">                                                 &lt;/a&gt;
</span><span class="cx">                                                 &lt;a target=&quot;_blank&quot; href=&quot;&lt;?php echo get_category_link($cat_item-&gt;cat_ID); ?&gt;&quot;&gt;
</span><del>-                                                        &lt;img alt=&quot;View Page&quot; title=&quot;View Page&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-viewpage.png&quot; /&gt;
</del><ins>+                                                        &lt;img alt=&quot;=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; title=&quot;=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-viewpage.png'); ?&gt;&quot; /&gt;
</ins><span class="cx">                                                 &lt;/a&gt;
</span><span class="cx">                                                 &lt;/span&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -622,20 +447,20 @@
</span><span class="cx">                                                                 &lt;/a&gt;
</span><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;postmenu&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;postmenu&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $cat_item-&gt;cat_ID; ?&gt;&quot; /&gt;
</span><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;parent&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;0&quot; /&gt;
</span><del>-                                        &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;title&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo htmlentities($cat_item-&gt;cat_name); ?&gt;&quot; /&gt;
-                                        &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo get_category_link($cat_item-&gt;cat_ID); ?&gt;&quot; /&gt;
-                                        &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;description&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo htmlentities($cat_item-&gt;category_description); ?&gt;&quot; /&gt;
</del><ins>+                                        &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;title&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo esc_attr($cat_item-&gt;cat_name); ?&gt;&quot; /&gt;
+                                        &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo esc_attr(get_category_link($cat_item-&gt;cat_ID)); ?&gt;&quot; /&gt;
+                                        &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;description&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo esc_attr($cat_item-&gt;category_description); ?&gt;&quot; /&gt;
</ins><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;icon&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;icon&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;0&quot; /&gt;
</span><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;position&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;position&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot; /&gt;
</span><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;linktype&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;category&quot; /&gt;
</span><del>-                                        &lt;input type=&quot;hidden&quot; name=&quot;anchortitle&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;anchortitle&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo htmlentities($cat_item-&gt;cat_name); ?&gt;&quot; /&gt;
</del><ins>+                                        &lt;input type=&quot;hidden&quot; name=&quot;anchortitle&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;anchortitle&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo esc_attr($cat_item-&gt;cat_name); ?&gt;&quot; /&gt;
</ins><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;newwindow&lt;?php echo $intCounter; ?&gt;&quot; id=&quot;newwindow&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;0&quot; /&gt;
</span><span class="cx"> 
</span><span class="cx">                                         &lt;?php $parentli = $cat_item-&gt;cat_ID; ?&gt;
</span><span class="cx">                                         &lt;?php $intCounter++; ?&gt;
</span><span class="cx">                                         &lt;?php
</span><span class="cx"> 
</span><del>-                                                //Recursive function
</del><ins>+                                                // Recursive function
</ins><span class="cx">                                                 $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories','menu');
</span><span class="cx"> 
</span><span class="cx">                                         ?&gt;
</span><span class="lines">@@ -643,7 +468,7 @@
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php
</span><del>-                        } elseif ($type == 'default') {
</del><ins>+                        } elseif ( $type == 'default' ) {
</ins><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li&gt;
</span><span class="lines">@@ -657,13 +482,13 @@
</span><span class="cx">                                         $description = htmlentities(strip_tags($cat_item-&gt;description));
</span><span class="cx">                                         ?&gt;
</span><span class="cx">                                         &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
</span><del>-                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $cat_item-&gt;cat_name; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','Category','&lt;?php echo $post_text; ?&gt;','&lt;?php echo $post_url; ?&gt;','&lt;?php echo $post_id; ?&gt;','&lt;?php echo $post_parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $post_text; ?&gt;&quot; value=&quot;&lt;?php echo $post_url;  ?&gt;&quot;&gt;&lt;img alt=&quot;Add to Custom Menu&quot; title=&quot;Add to Custom Menu&quot;  src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-add.png&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
</del><ins>+                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo esc_html($cat_item-&gt;cat_name); ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','Category','&lt;?php echo $post_text; ?&gt;','&lt;?php echo $post_url; ?&gt;','&lt;?php echo $post_id; ?&gt;','&lt;?php echo $post_parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $post_text; ?&gt;&quot; value=&quot;&lt;?php echo $post_url;  ?&gt;&quot;&gt;&lt;img alt=&quot;=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; title=&quot;=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot;  src=&quot;&lt;?php echo admin_url('images/ico-add.png'); ?&gt;&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
</ins><span class="cx">                                         &lt;/dl&gt;
</span><span class="cx">                                         &lt;?php $parentli = $cat_item-&gt;cat_ID; ?&gt;
</span><span class="cx">                                         &lt;?php $intCounter++; ?&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                //Recursive function
-                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories','default');
</del><ins>+                                                // Recursive function
+                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'default');
</ins><span class="cx">                                         ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="lines">@@ -682,12 +507,12 @@
</span><span class="cx">         $counter = $intCounter;
</span><span class="cx"> 
</span><span class="cx">         // Custom Menu
</span><del>-        if ($output_type == 'menu') {
</del><ins>+        if ( $output_type == 'menu' ) {
</ins><span class="cx">                 $sub_args = array(
</span><span class="cx">                 'child_of' =&gt; $childof,
</span><span class="cx">                 'hide_empty' =&gt; false,
</span><span class="cx">                 'parent' =&gt; $childof);
</span><del>-        } elseif ($output_type == 'default') {
</del><ins>+        } elseif ( $output_type == 'default' ) {
</ins><span class="cx">                 // Sidebar Menu
</span><span class="cx">                 $sub_args = array(
</span><span class="cx">                 'child_of' =&gt; $childof,
</span><span class="lines">@@ -708,15 +533,14 @@
</span><span class="cx"> 
</span><span class="cx">         if ( $sub_array ) {
</span><span class="cx">                 ?&gt;
</span><del>-
</del><span class="cx">                 &lt;ul id=&quot;sub-custom-nav-&lt;?php echo $type ?&gt;&quot;&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;?php
</span><span class="cx">                 // Display Loop
</span><span class="cx">                 foreach ( $sub_array as $sub_item ) {
</span><del>-                        //Prepare Menu Data
-                        //Category Menu Item
</del><ins>+                        // Prepare Menu Data
</ins><span class="cx">                         if ( $type == 'categories' ) {
</span><ins>+                                // Category Menu Item
</ins><span class="cx">                                 $link = get_category_link($sub_item-&gt;cat_ID);
</span><span class="cx">                                 $title = htmlentities($sub_item-&gt;cat_name);
</span><span class="cx">                                 $parent_id = $sub_item-&gt;cat_ID;
</span><span class="lines">@@ -749,12 +573,12 @@
</span><span class="cx">                                                 &lt;span class=&quot;title&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/span&gt;
</span><span class="cx">                                                         &lt;span class=&quot;controls&quot;&gt;
</span><span class="cx">                                                         &lt;span class=&quot;type&quot;&gt;&lt;?php echo $linktype; ?&gt;&lt;/span&gt;
</span><del>-                                                        &lt;a id=&quot;edit&lt;?php echo $counter; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $counter; ?&gt;)&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;Edit Menu Item&quot; title=&quot;Edit Menu Item&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-edit.png&quot; /&gt;&lt;/a&gt;
</del><ins>+                                                        &lt;a id=&quot;edit&lt;?php echo $counter; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $counter; ?&gt;)&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-edit.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
</ins><span class="cx">                                                                 &lt;a id=&quot;remove&lt;?php echo $counter; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $counter; ?&gt;)&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;
</span><del>-                                                                        &lt;img class=&quot;remove&quot; alt=&quot;Remove from Custom Menu&quot; title=&quot;Remove from Custom Menu&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-close.png&quot; /&gt;
</del><ins>+                                                                        &lt;img class=&quot;remove&quot; alt=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-close.png'); ?&gt;&quot; /&gt;
</ins><span class="cx">                                                                 &lt;/a&gt;
</span><span class="cx">                                                                 &lt;a target=&quot;_blank&quot; href=&quot;&lt;?php echo $link; ?&gt;&quot;&gt;
</span><del>-                                                                        &lt;img alt=&quot;View Page&quot; title=&quot;View Page&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-viewpage.png&quot; /&gt;
</del><ins>+                                                                        &lt;img alt=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-viewpage.png'); ?&gt;&quot; /&gt;
</ins><span class="cx">                                                                 &lt;/a&gt;
</span><span class="cx">                                                 &lt;/span&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -776,7 +600,7 @@
</span><span class="cx">                                         &lt;?php $counter++; ?&gt;
</span><span class="cx">                                         &lt;?php
</span><span class="cx"> 
</span><del>-                                                //Do recursion
</del><ins>+                                                // Do recursion
</ins><span class="cx">                                                 $counter = wp_custom_navigation_default_sub_items($parent_id, $counter, $parent_id, $type, 'menu');
</span><span class="cx"> 
</span><span class="cx">                                         ?&gt;
</span><span class="lines">@@ -791,11 +615,11 @@
</span><span class="cx">                                         &lt;dt&gt;
</span><span class="cx"> 
</span><span class="cx">                                         &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
</span><del>-                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','&lt;?php echo $appendtype; ?&gt;','&lt;?php echo $title; ?&gt;','&lt;?php echo $link; ?&gt;','&lt;?php echo $itemid; ?&gt;','&lt;?php echo $parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $title; ?&gt;&quot; value=&quot;&lt;?php echo $link; ?&gt;&quot;&gt;&lt;img alt=&quot;Add to Custom Menu&quot; title=&quot;Add to Custom Menu&quot; src=&quot;&lt;?php echo get_bloginfo('url'); ?&gt;/wp-admin/images/ico-add.png&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
</del><ins>+                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','&lt;?php echo $appendtype; ?&gt;','&lt;?php echo $title; ?&gt;','&lt;?php echo $link; ?&gt;','&lt;?php echo $itemid; ?&gt;','&lt;?php echo $parent_id ?&gt;','&lt;?php echo $description; ?&gt;')&quot; name=&quot;&lt;?php echo $title; ?&gt;&quot; value=&quot;&lt;?php echo $link; ?&gt;&quot;&gt;&lt;img alt=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-add.png'); ?&gt;&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
</ins><span class="cx">                                         &lt;/dl&gt;
</span><span class="cx">                                         &lt;?php
</span><span class="cx"> 
</span><del>-                                                //Do recursion
</del><ins>+                                                // Do recursion
</ins><span class="cx">                                                 $counter = wp_custom_navigation_default_sub_items($itemid, $counter, $parent_id, $type, 'default');
</span><span class="cx"> 
</span><span class="cx">                                         ?&gt;
</span><span class="lines">@@ -824,17 +648,15 @@
</span><span class="cx"> 
</span><span class="cx">         $counter = $intCounter;
</span><span class="cx"> 
</span><del>-        //Get Sub Category Items
</del><span class="cx">         if ( $type == 'categories' ) {
</span><ins>+                // Get Sub Category Items
</ins><span class="cx">                 $sub_args = array(
</span><span class="cx">                         'child_of' =&gt; $childof,
</span><span class="cx">                         'hide_empty'  =&gt; false,
</span><span class="cx">                         'parent' =&gt; $childof);
</span><span class="cx">                 $sub_array = get_categories($sub_args);
</span><del>-        }
-        //Get Sub Page Items
-        elseif ($type == 'pages')
-        {
</del><ins>+        } elseif ($type == 'pages') {
+                // Get Sub Page Items
</ins><span class="cx">                 $sub_args = array(
</span><span class="cx">                         'child_of' =&gt; $childof,
</span><span class="cx">                         'parent' =&gt; $childof);
</span><span class="lines">@@ -846,18 +668,17 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( $sub_array ) {
</span><del>-                //DISPLAY Loop
</del><ins>+                // DISPLAY Loop
</ins><span class="cx">                 foreach ( $sub_array as $sub_item ) {
</span><del>-                        if ( isset($sub_item-&gt;parent) ) {
</del><ins>+                        if ( isset($sub_item-&gt;parent) )
</ins><span class="cx">                                 $sub_item_parent = $sub_item-&gt;parent;
</span><del>-                        } elseif (isset($sub_item-&gt;post_parent)) {
</del><ins>+                        elseif (isset($sub_item-&gt;post_parent))
</ins><span class="cx">                                 $sub_item_parent = $sub_item-&gt;post_parent;
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         // Is child
</span><span class="cx">                         if ( $sub_item_parent == $childof ) {
</span><del>-                                //Prepare Menu Data
-                                //Category Menu Item
</del><ins>+                                // Prepare Menu Data
+                                // Category Menu Item
</ins><span class="cx">                                 if ( $type == 'categories' ) {
</span><span class="cx">                                         $link = get_category_link($sub_item-&gt;cat_ID);
</span><span class="cx">                                         $title = htmlentities($sub_item-&gt;cat_name);
</span><span class="lines">@@ -866,7 +687,7 @@
</span><span class="cx">                                         $linktype = 'category';
</span><span class="cx">                                         $appendtype= 'Category';
</span><span class="cx">                                 }
</span><del>-                                //Page Menu Item
</del><ins>+                                // Page Menu Item
</ins><span class="cx">                                 elseif ( $type == 'pages' ) {
</span><span class="cx">                                         $link = get_permalink($sub_item-&gt;ID);
</span><span class="cx">                                         $title = htmlentities($sub_item-&gt;post_title);
</span><span class="lines">@@ -875,21 +696,18 @@
</span><span class="cx">                                         $itemid = $sub_item-&gt;ID;
</span><span class="cx">                                         $appendtype= 'Page';
</span><span class="cx">                                 }
</span><del>-                                //Custom Menu Item
</del><ins>+                                // Custom Menu Item
</ins><span class="cx">                                 else {
</span><span class="cx">                                         $title = '';
</span><span class="cx">                                         $linktype = 'custom';
</span><span class="cx">                                         $appendtype= 'Custom';
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                //CHECK for existing parent records
-                                //echo $parent_id;
</del><ins>+                                // CHECK for existing parent records
+                                // echo $parent_id;
</ins><span class="cx">                                 $wp_result = $wpdb-&gt;get_results(&quot;SELECT id FROM &quot;.$table_name.&quot; WHERE post_id='&quot;.$parent_id.&quot;' AND link_type='&quot;.$linktype.&quot;' AND menu_id='&quot;.$menu_id.&quot;'&quot;);
</span><del>-                                if ($wp_result &gt; 0 &amp;&amp; isset($wp_result[0]-&gt;id)) {
</del><ins>+                                if ( $wp_result &gt; 0 &amp;&amp; isset($wp_result[0]-&gt;id) )
</ins><span class="cx">                                         $parent_id = $wp_result[0]-&gt;id;
</span><del>-                                } else {
-                                        //$parent_id = 0;
-                                }
</del><span class="cx"> 
</span><span class="cx">                                 //INSERT item
</span><span class="cx">                                 $insert = &quot;INSERT INTO &quot;.$table_name.&quot; (position,post_id,parent_id,custom_title,custom_link,custom_description,menu_icon,link_type,menu_id,custom_anchor_title) &quot;.&quot;VALUES ('&quot;.$counter.&quot;','&quot;.$itemid.&quot;','&quot;.$parent_id.&quot;','&quot;.$title.&quot;','&quot;.$link.&quot;','','','&quot;.$linktype.&quot;','&quot;.$menu_id.&quot;','&quot;.$title.&quot;')&quot;;
</span></span></pre>
</div>
</div>

</body>
</html>