I need to add a search field at the end of a menu in a list item.
I've been looking at walkers but finding it really hard to figure out what is the last item (or even get the total). Also where would i add the code for the custom item.
I've currently got;
class mainNav_walker extends Walker_Nav_Menu
{
public function start_el( &$output, $item, $depth, $args )
{
//print_r($item);
$output .= $this->custom_content( $item );
parent::start_el( &$output, $item, $depth, $args );
}
protected function custom_content( $item )
{
// add <li>SEARCH FIELD HERE?</li>
}
}