Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MorphingDragon

macrumors 603
Original poster
Mar 27, 2009
5,159
6
The World Inbetween
I've been trying to implement a custom WP search box and I'm a bit stuck. Normally I would just use the default WP search however it just doesn't suit the website design. I'm don't really know any PHP or Javascript so I've been struggling to implement this.

I basically want it to behave as you would expect a search box to behave. (IE, enter text and press enter)

I have attached a quick mockup of the website header so you can see what I want to achieve.

This is the default WP code if it helps.

Code:
<form action="/" method="get">
    <fieldset>
        <label for="search">Search in <?php echo home_url( '/' ); ?></label>
        <input type="text" name="s" id="search" value="<?php the_search_query(); ?>" />
        <input type="image" alt="Search" src="<?php bloginfo( 'template_url' ); ?>/images/search.png" />
    </fieldset>
</form>
 

Attachments

  • mock1.jpg
    mock1.jpg
    79.4 KB · Views: 128
Don't try and change the PHP, just place the search form code
Code:
<?php get_search_form(); ?>
in a new DIV and style it with the CSS.

Why try and change the PHP, just style the existing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.