Storefront Edge theme, add Search box to the top of the page

Posted by on Jun 30, 2012 in Blog, Edge, Storefront Themes | No Comments

The Storefront themes Edge theme lacks a integrated search box which means you have to add search via a widget. This makes Edge users a little envious of the other themes. So lets soothe those egos.

The PHP

You will need to add a couple of lines to header.php which you will find in the Edge theme folder. This is easy if you have never done it, jump in and a give it a try. There are tips and free tools listed at the end of this post.
Line numbers are based on Edge theme version 1.1.2, you should have no trouble finding the code in other versions. This edit is quite easy, you could probably find the lines in header.php by going to Appearance/Editor and opening the file there. You will not have line numbers but it is easy to find that “End of Cart Tab” line.

Find the first and last lines of code shown below around line 82. In between add the highlighted lines

<!-- ========== End of Cart Tab =========== -->
    <div class="navsearch">
				<?php get_search_form(); ?>
				</div>
<div class="clear"></div><!-- CLEAR -->

File download

Now download and unzip this PHP file and add it to the Edge theme folder.

CSS

You will also need to add some css so search sits up at the top near the checkout tab. You can add more to style it as you wish. Just put this in the Storefront Options Panel/Style Tab Custom CSS box and save.

.navsearch {
     padding: 3px 0px;
     position: absolute;
     right: 280px;
}

#s.field{
     line-height: 1.3em;
     padding: 6px;
}

PHP Tools:

You may edit your PHP outside WordPress and upload it to your server. You must use an appropriate code editor NOT microsoft word or anything like that which adds a lot of invisible formatting and will be a disaster.
If you do not have one, 2 excellent free ones are…
TextWrangler for Mac, http://www.barebones.com/products/textwrangler/
Notepad++ for the PC http://notepad-plus-plus.org/

Custom CSS:

This code belongs in your Custom CSS file. Don’t have a custom.css? There is an empty one for you to use in the theme folder? You can edit custom.css by going to Appearance/Editor and choosing custom.css from the list of files.
You can also just paste this code in the “Custom CSS” box in the Storefront options panel on the Style tab if you will not be making many changes, but it is a bit hard to work with there.

Leave a Reply