Stand with Ukraine. Fight for freedom and democracy

Donate
Back to contents

JetSearch: How to Set the Source in AJAX Search

This tutorial will assist you in improving your knowledge of the JetSearch plugin. You will learn how to specify the source of post content displayed in the search results with the help of the AJAX Search widget/block.

Tutorial requirements:

  • JetSearch plugin installed and activated;
  • Page built with Block Editor or Elementor Page Builder free version to place the AJAX Search block/widget;
  • Content to conduct the search. It can be WooCommerce products, pages, Custom Post Type posts with JetEngine, or default WordPress posts;
  • Search results template built with JetThemeCore.

With the JetSearch plugin, it’s possible to use the AJAX Search widget, which can help you set the right source that will be displayed in the search results.

Working on the Results Area in Elementor

In case you are working with the Elementor Page Builder, open the needed page and move to the Source field in the Search Query section. Click on the field bar to see the list of available options.

You can conduct a search among posts, pages, WooCommerce products, and CPTs created with JetEngine.

Firstly, let’s check what result we will get when the field is left empty. It should retrieve the results from all the available sources.

We press the “Publish/Update” button and head to the front end.

presented sources in elementor

Here we can see that once the search request has been made, there are different results shown. In our case, you can observe a product, a post, and a page.

search with no source selected on the front end

Return to the editor to set the different source; this time, it will be the only one. For instance, “Products.”

products source in elementor

Take a look at the edited page and the search results for now.

search with products source

The last setup we will look at is selecting several sources. As an example, we choose WordPress “Posts” and a CPT we have built with JetEngine.

two sources selected in elementor

Looking at the front end, we can observe two CPT posts and one usual WordPress post in the results area.

search with two sources selected

Adjusting the Search Area with Block Editor

Go to the page where you use the AJAX Search block and open the settings. Here you can see many different options for customizing the block as you wish, just like in Elementor. In the Search Query tab, there is the field where you should select the appropriate post type in which you want to implement the search.

no source selected in gutenberg

The Source field here works the samely as in Elementor. You can leave it empty to retrieve all the available formats, select one source, or add several.

The result obtained will stay identical to the presented before in part dedicated to working with Elementor in this article.

For example, let’s check the result once the source is set to CPT built with JetEngine.

Click on the “Publish/Update” button to save the page.

gutenberg ajax search block source

On the front end, you can see only posts from the set CPT in the results area.

search results area with cpt source

That’s it; you have discovered how to customize the source of the post content in the search results area in the JetSearch AJAX Search widget.