Designing an Effective Search Bar & Template in Oxygen

Web Development & Design
Surfer AI - Best All-in-one Assistant

- Your article will be ready in less than 20 minutes and it will be 10 times cheaper than using a dedicated writer.
- Create ready-to-rank articles in minutes with Surfer AI.
- Research, write, and optimize across industries with the click of a button.

1 of the excellent items you can do when producing a WordPress website is to include a search characteristic. This can be super valuable for site visitors who are hunting for distinct data on your website. You can simply include a search bar and search webpage to your website employing Oxygen Builder.

In this tutorial, we’ll demonstrate you how to generate a search bar and search webpage in Oxygen Builder. We’ll also go more than some of the rewards of getting a search characteristic on your WordPress website.

Why do you require a Search Bar in WordPress?

A search bar is a excellent way to support site visitors discover what they are hunting for on your WordPress website. If you have a great deal of content material, a search bar can be specially valuable.

For instance, let us say you have a website with one hundred posts. A visitor comes to your website and would like to read through a distinct publish about cats. The visitor can use the search bar to search for the phrase “cats” and all of the posts that consist of the phrase “cats” will seem in the benefits.

The visitor can then click on the publish they want to read through and be taken immediately to that publish. This is significantly less complicated than getting the visitor scroll by way of all one hundred posts to discover the 1 they want.

Advantages of a Search Webpage in Oxygen

There are a number of rewards of getting a search webpage on your WordPress website. Initial, it assists to hold your website organized. If you have a great deal of content material, a search webpage can support site visitors discover what they are hunting for without having getting to scroll by way of all of your content material. 2nd, a search webpage can support enhance the consumer knowledge on your website. If site visitors can simply discover what they are hunting for, they are much more probably to keep on your website and carry on searching. And lastly, a search webpage can support you track which subjects are most well-known on your website. You can use this data to generate much more content material that is appropriate to your audience.

How to create a Search Bar in Oxygen

Phase one: Use created-in search bar widget

Oxygen Builder comes with a created-in search type widget that you can use to include a search bar to your WordPress website. To use the widget, just drag and drop it into your wanted spot. As soon as you have additional the widget, you can customize it to match the seem and truly feel of your website.

Phase two: Customize the search bar

The default search bar comes with a number of distinct alternatives that you can customize. You can modify the type discipline and the submit button. The default block is quite unsightly, so we’re going to go ahead and fashion it to match the seem and truly feel of our website. Make certain suitable formatting is set up (centered, in the header, and so forth). As soon as the layout is carried out, we’re going to include the template so we can acquire our benefits.

Ahead of &amp Right after Search Bar Styling

How to create a Search Webpage in Oxygen

Phase one: Setting the Webpage Template

The 1st issue we require to do is generate a new webpage and assign it the “Search” template. Head into your Oxygen template webpage and generate a new template. Inherit the background of the styling you want on your search webpage. Now underneath “other” choose ”Search Outcomes” and conserve the template. Make certain to set the template priority larger than your other publish templates, or the search will not redirect appropriately.

Phase two: Incorporating The Search Outcomes with EasyPosts

Now that we have our search webpage template, we can include the search benefits employing the EasyPosts widget. The EasyPosts widget will let us to query our WordPress database and show the benefits on our search webpage.

To use the EasyPosts widget, just drag and drop it into your wanted spot. In the widget settings, you are going to want to hold the query set to default and fashion your posts in what ever way you want!

Phase three: Include Search End result Title

If you want to demonstrate the query end users are seeking for, we can simply use php to show the search phrase. This code goes in the html/php part of a code block.

<?php echo esc_html(get_search_query(false))?>

You could wrap this in an h1 tag and include “Search Outcomes:” prior to the php if you want to set it as your webpage header. Conserve your adjustments and you happen to be all set! Now when end users search for one thing on your WordPress website, they will be taken to a search benefits webpage that displays all of the posts that match their query.

Make your Search Webpage Adaptive:

You can make your new webpage adaptive by incorporating issue settings to your EasyPosts widget. This will let you to demonstrate distinct content material on your search webpage based on what gadget a consumer is employing. For instance, you could demonstrate five benefits on desktop products and ten benefits on mobile products.

You could also set conditional settings to demonstrate distinct benefits based on if the query returns any benefits. This is valuable due to the fact you can demonstrate a “No benefits discovered” message if there are no posts that match the user’s query.

To do this, you can use a code snippet created by Elijah from Oxygen and include it to any sort of snippet manager (we use Code Snippets)

if( perform_exists('oxygen_vsb_register_condition') ) {

international $oxy_issue_operators

oxygen_vsb_register_issue('Has Results', array('options'=>array('true', 'false'), 'custom'=>false), array('=='), 'search_has_benefits_callback', 'Search')

perform search_has_benefits_callback($worth, $operator) {

international $wp_query
$posts_discovered = $wp_query->found_posts

if( $worth == "correct" && $posts_discovered > ) {
  return correct
} else if( $worth == "false" && $posts_discovered ==  ) {
  return correct



Now, include a issue to only demonstrate your query if “Has Posts” is equal to correct. Otherwise, you can include a message that says “No benefits discovered”.


The search characteristic is a potent device that can support you hold your WordPress website organized and enhance your consumer knowledge. By producing a search webpage, you can make it less complicated for site visitors to discover the content material they are hunting for. So why not include a search webpage to your Oxygen website right now? You may possibly be shocked at how significantly it can support include some complexity and organization to your website.

If you have any concerns about this tutorial, truly feel totally free to publish them in the feedback part beneath. We hope this assisted!