Help Center
How to Display Terms in the Search Results Area

How to Display Terms in the Search Results Area

This tutorial explains how to display terms in the search results area along the posts using the JetSearch plugin on the example of the WooCommerce products categories on the WordPress e-commerce site.

Before you start, check the tutorial requirements:

  • Elementor (Free version), Block editor (Gutenberg), or Bricks

  • JetSearch plugin installed and activated

The Ajax Search widget/block/element is the JetSearch feature that allows fast search on WordPress websites.

By default, Ajax Search displays posts in the results area. The Additional Results settings allow the search and display of the terms or/and users along with posts.

In this tutorial, we describe how to display terms in the search results area using the example of the WooCommerce product categories on the bookstore e-commerce website.

Be aware that such a tutorial isn’t case-sensitive, and you can display custom taxonomies along with posts of the Custom Post Type.

How to Display Terms in the Search Results Area

As described in the How to Add an AJAX Search to a Website’s Header tutorial, we place the Ajax Search widget to a header in the Elementor editor.

Things to know

The provided functionality is accessible if you have the JetThemeCore plugin installed and activated. However, it is not required in the described case; you can add Ajax Search to other pages/templates built with Elementor, Gutenberg, or Bricks.

Initially, you can open the Search Query tab and select the required post types as the Source. For example, we set the WooCommerce “Products” post type.

woocommerce products post type as the search source

We unroll the Additional Results tab and enable the Terms Search Source toggle to adjust extra settings.

additional results terms search source

First, we pick the needed Taxonomy in the namesake drop-down (“Product categories”), and the term names appear in the search results area if they match the request.

choose taxonomy for additional results

Then, we fill in the Title field (“Book categories”).

terms search results title

Next, in the Icon section, we click the “Icon Library” option, pick the suited icon, and press the “Insert” button.

additional results icon library

The icon we set appears on the left of the term name in the search results area.

icon for the terms additional results

We keep the Limit as it is set by default (“5”). It means the search results area will display a maximum of five terms results.

Things to know

To style the terms additional search results, open the Style section of the Ajax Search widget and unroll the Additional Results tab.

terms additional search results style settings

Using Listing Template for the Terms Search Results

Things to know

The Listing drop-down menu is available if you install and activate the JetEngine plugin.

With a listing template, you can customize the display of the terms as you wish. For example, you can display different icons for each term (with the Icon option in the Additional Results tab of the Ajax Search widget, you can set only one icon for all terms) and extra information for each term, such as a description.

To create a Listing template for taxonomies, we go to the WordPress Dashboard > JetEngine > Listings/Components tab and click the “Add New Listing Item” button.

In the Setup Listing Item pop-up, we pick the “Terms” option as the Listing source, set the required taxonomy in the From taxonomy field (“Product categories”), enter the Listing item name (“Product Categories Listing”), and choose the Listing view (for this case we choose “Elementor”).

Afterward, we click the “Create Listing Item” button.

creating a listing item for additional search results terms

You can customize the listing template using different elements, such as Dynamic Widgets.

We place such widgets in the Elementor editor:

dynamic widgets for the listing item for additional search results terms

To learn more, proceed to the How to Create a Listing Template for Custom Taxonomy in Elementor tutorial.

After customizing the listing template, we save the changes by hitting the “Publish/Update” button.

We return to the header template and select the just-built listing item in the Listing drop-down menu in the Additional Results tab of the Ajax Search widget.

Afterward, the design set in the listing template will be applied to the terms in the search results area.

terms additional search results listing template

After adjusting the Ajax Search widget settings, we push the “Update” button.

How to Display Terms on the Search Results Page

To display the terms on the Search Results page, you need to create a custom query that can be achieved with the Query Builder feature of the JetEngine plugin.

To craft the Search Results page, proceed to the How to Make the Custom URL for the Search Results Page tutorial.

Since we work with WooCommerce products, we complete the steps described in the Displaying WooCommerce Products chapter of the mentioned tutorial.

First, we navigate to the WordPress Dashboard > Crocoblock > JetPlugins Settings > JetSearch > Ajax Search Settings tab, scroll down to the Search Query Param, and copy it. In our case, it’s the default “jet_search” query parameter name.

search query param

To create a custom query, we go to the WordPress Dashboard > JetEngine > Query Builder tab and hit the “Add New” button.

In the General Settings section, we enter the query Name (“Terms additional search results”) and select the “Terms QueryQuery Type.

In the General tab of the Terms Query section, we pick the needed Taxonomy (“Product categories”).

terms search results query

In the Include/Exclude tab, we click the “coin stack” button near the Search field and choose the “Query Variable” macro. 

In the pop-up, we set the copied “jet_search” text from the Search Query Param field and press the “Apply” button.

Then, we hit the “Add/Update Query” button.

query variable for the terms search results

Afterward, we move to the WordPress Dashboard > Pages tab and open the Search Results page in the Elementor editor.

Here, we have already added the Products List widget to display searched products (the Products Grid and Listing Grid widgets can also be used).

To display the searched terms, we place the Listing Grid widget and choose the Listing created for the terms mentioned in the Using Listing Template for the Terms Search Results chapter of this tutorial.

If you haven’t crafted a listing yet, you can also check the How to Create a Listing Template for Custom Taxonomy in Elementor tutorial.

terms listing grid on the search results page

Next, we unroll the Custom Query tab, enable the Use Custom Query toggle, and select the just-built query in the Custom Query drop-down menu.

applying the custom query to the terms listing grid

After finishing customizing the Search Results page, we hit the “Update” button.

Eventually, we proceed to the Home page on the front end, enter a request into the search bar of the Ajax Search widget, and click the “Submit” button.

home page on the front end with ajax search

The Search Results page shows the searched terms and products as intended.

search results page with terms and products

How to Display Terms on the Search Results Archive Template

To display the terms on the Search Results page, you need to create a custom query that can be achieved with the Query Builder feature of the JetEngine plugin.

We go to the WordPress Dashboard > JetEngine > Query Builder tab and hit the “Add New” button.

In the General Settings section, we enter the query Name (“Terms additional search results”) and select the “Terms QueryQuery Type.

In the General tab of the Terms Query section, we pick the needed Taxonomy (“Product categories”).

terms search results custom query

In the Include/Exclude tab, we click the “coin stack” button near the Search field and choose the “Query Variable” macro. 

In the pop-up, we enter the “s” value and press the “Apply” button.

Then, we hit the “Add/Update Query” button.

query variable for the terms search result

To learn how to create an Archive Search template for posts with the JetThemeCore plugin, proceed to the How to Create an Archive Template to Display the Search Results tutorial.

The How to Create a Search Page Template describes how to build a Search Page template for WooCommerce products.

We move to the WordPress Dashboard > Crocoblock > Theme Builder tab, where we created the Search Results Page template with header, body, and footer.

We set such conditions by hitting the “three dots” and “Edit conditions” buttons near the page title: “Include,” “WooCommerce,” and “Search Results.” The conditions can be saved by clicking the “Save” button.

conditions for the search results page

To alter the Search Results body template, we hit the “three dots” and “Edit content” buttons near it. This template was created with the JetThemeCore plugin in the Elementor editor.

edit content of the search results body template

Here, we have already added the Products List widget with the Use Current Query toggle enabled to display requested products on the Search Results archive template. You can also use the Products Grid widget with the same toggle activated or with the Listing Grid widget with the Use as Archive Template toggle enabled.

use current query for product list

To display the searched terms, we place the Listing Grid widget and choose the Listing created for the terms mentioned in the Using Listing Template for the Terms Search Results chapter of this tutorial.

If you haven’t crafted a listing yet, you can also check the How to Create a Listing Template for Custom Taxonomy in Elementor tutorial.

terms listing grid on the search results template

Next, we unroll the Custom Query tab, enable the Use Custom Query toggle, and select just-built query in the Custom Query drop-down menu.

applying the query to the terms listing grid

After finishing customizing the Search Results page, we hit the “Update” button.

Eventually, we proceed to the Home page on the front end, enter a request into the search bar of the Ajax Search widget, and click the “Submit” button.

home page on the front end with ajax search widget

The Search Results Page template shows the searched terms and products as intended.

search results page with product categories and products

That’s all. Now you know how to display terms in the search results area along the posts using the JetSearch plugin on the example of the WooCommerce products categories on the WordPress e-commerce site.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.