How to add the Super Speedy Search widget into your header

Super Speedy Search has a gorgeous variety of display options to choose from, but what use is that if you can’t put them where you want to?

WordPress has a wide variety of themes to choose from and pretty much every one differs in how you control your header. In this KB, you’ll learn how to add the widget of your choice into your header, regardless of which theme you are using.

Option 1 – Appearance > Widgets

This should be the first place you check – this is the traditional way of controlling your header. So navigate to Appearance > Widgets and see if your theme has a ‘header’ widget area. If so, just add our Super Speedy Search widget, configure it, and off you go!

Option 2 – Customizer

Next place to check is in your Customizer. Many themes have added a ‘Header’ option in here where you can control widgets inside your header.

Once you have your HTML item in your header, use our shortcode to add the Super Speedy Widget.

Option 3 – Full Site Editor

If you are using a Full Site Editor, you are probably quite comfortable with editing your header.

Click the button to open your full site editor and edit your header, click to add a widget, choose our Super Speedy Search widget and then choose your configuration options

Option 4 – use an action provided by your theme

Most themes will provide ‘actions’ all over their theme code to let you (and them) customize the theme at will.

To see if your theme does, open the header.php file which you can find in wp-content/themes/{yourthemename}

Have a look down through the HTML & PHP code and look for do_action calls.

If you have found a do_action call, you now need to edit your functions.php file (or use the code snippets plugin). Using the example above, we would add something like this:

add_action('shoptimizer_header', function() {
    echo do_shortcode('[superspeedysearch]');
}, 40);

The number 40 refers to the priority – you can adjust this to make the search widget be output sooner or later depending on what other items are attached to this shoptimizer_header action.

Option 5 – Edit your header.php

If all else fails, this way always works. First, visit your child theme and look for a file called header.php. It should be in the root folder of your child theme. If you do not find it, go to your parent theme and copy the header.php file from there to your child theme. Once you have your header.php file in your child theme, edit it and look for a suitable place to put the widget.

Most themes will have some kind of search already in their header. Firstly, you need to disable that in their theme options, but then when looking at the header.php file if you see mention of search then you know this is where their search widget would go if you had it enabled.

So that’s probably a suitable spot to put our search widget. To add it, add code like this:

    echo do_shortcode('[superspeedysearch]');

If you avoid adding parameters to the shortcode, it will use whatever you’ve set at the global Super Speedy Search settings page.

Be the first to comment and we'll reply right away.

Leave a reply

Super Speedy Plugins
Logo