title: Injecting a custom ul into a menu
body: <p>So I am using a cool little function to render a search bar in my menu. Check it out here:</p>
  
  <pre><code>    function add_search_to_wp_menu ( $items, $args ) {
      if( 'main-menu' === $args -&gt; theme_location ) {
  $items .= '&lt;li class="menu-item menu-item-search"&gt;';
  $items .= '&lt;form method="get" class="menu-search-form" action="' . get_bloginfo('home') . '/"&gt;&lt;p&gt;&lt;input class="text_input" type="text" value="Enter Text &amp;amp; Click to Search" name="s" id="s" onfocus="if (this.value == \'Enter Text &amp;amp; Click to Search\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'Enter Text &amp;amp; Click to Search\';}" /&gt;&lt;input type="submit" class="my-wp-search" id="searchsubmit" value="search" /&gt;&lt;/p&gt;&lt;/form&gt;';
  $items .= '&lt;/li&gt;';
      }
  return $items;
  }
  add_filter('wp_nav_menu_items','add_search_to_wp_menu',10,2);
  </code></pre>
  
  <p>I didn't make it - but its doing the job.</p>
  
  <p>So the only problem is that it is appearing at the top level:</p>
  
  <pre><code>&lt;ul&gt;
  &lt;li&gt;Normal Item&lt;/li&gt;
  &lt;li&gt;OH LOOOK THE SEATCHBAR APPEARS HERE&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>The problem is that I need it to appear a few more steps down in the menu, ie - here:</p>
  
  <pre><code>&lt;ul&gt;
   &lt;li&gt;
     Normal Item
      &lt;ul&gt;
        &lt;li&gt;
             I want THE SEARCH to appear here
        &lt;/li&gt;
     &lt;ul&gt;
   &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Not only that, I want it to appear after the last <code>&lt;ul&gt;&lt;li&gt;&lt;ul&gt;&lt;li&gt;</code> in the menu...</p>
  
  <p>IE, if I had a list of 3 normal items with their own sub items, it would look like this once injected:</p>
  
  <pre><code>   &lt;ul&gt;
       &lt;li&gt;
         Normal Item1
       &lt;/li&gt;
       &lt;li&gt;
         Normal Item2
       &lt;/li&gt;
       &lt;li&gt;
         Normal Item3
       &lt;/li&gt;
       &lt;li&gt;
         Normal Item
          &lt;ul&gt;
            &lt;li&gt;
             I want THE SEARCH to appear here
            &lt;/li&gt;
         &lt;ul&gt;
       &lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>Hopefully that makes sense. Thanks for the help!</p>