Viewing 1 replies (of 1 total)
  • Plugin Author joe_bopper

    (@joe_bopper)

    Hi thosandro,

    Yes, you can edit the html code output for the search box. You use the hook ‘get_nav_search_box_form’ in the same way as ‘get_search_form’ in your code. A typical and simple way of doing this would be:

    In your theme’s functions.php

    function my_nav_search_form(){
      ob_start(); //Start an output buffer
    ?>
    <form action="<?php echo esc_url( home_url( '/' ) ); ?>" method="get">
      <input type="text" value="<?php echo get_search_query() ?>" name="s" />
      <input type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" />
    </form>
    <?php
      return ob_get_clean(); //get buffered output as string and return
    }
    add_filter( 'get_nav_search_box_form', 'my_nav_search_form', 10, 0 );

    If you want to see the html and php used by default by the plugin, go to Trac and scroll to the function called walker_nav_menu_start_el.

    Let me know if you need any more info or if this topic can be considered resolved.

Viewing 1 replies (of 1 total)
  • The topic ‘edit the html of the search form’ is closed to new replies.