• Knowing little about PHP, I tried adding this code to my header:

    <?php
    function wp_widget_search($args) {
    extract($args);
    ?>
    <?php echo $before_widget; ?>
    <form id=”searchform” method=”get” action=”<?php bloginfo(‘home’); ?>”>
    <div>
    <input type=”text” name=”s” id=”s” size=”15″ />
    <input type=”submit” value=”<?php echo attribute_escape(__(‘Search’)); ?>” />
    </div>
    </form>
    <?php echo $after_widget; ?>
    <?php
    }
    ?>

    And probably unsurprisingly I got a fatal error. ??

    Can anyone tell me how to add the search functionality to somewhere other then the sidebar?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Don’t double post. All you need to add is this code.

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search" />
    </div>
    </form>
    Thread Starter Unit9

    (@unit9)

    Thanks Jeremy and sorry – won’t do it again – just realised I posted in the wrong forum! ??

    @jeremyclark13 – thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I add the search to the header?’ is closed to new replies.