Stand with Ukraine. Fight for freedom and democracy

Back to contents

JetSearch. How to manage Custom Fields in Ajax Search widget

This tutorial informs about the process of managing the Custom Fields block in the Ajax Search widget of JetSearch plugin.

Using JetSearch plugin you have an opportunity to display certain information from the meta fields of the posts in a search results area. In the Custom Fields section of the Ajax Search widget you need to specify meta keys and the particular data will be shown in the search.

Managing Custom Fields block

1 Step — Editing the widget

Open the page, where the Ajax Search widget is located. Then, click the Edit Ajax Search option and you will see the settings block.

Edit Ajax Search option

2 Step — Determining the search areas

First of all, specify the particular search areas (post types) in the Source field in the Search Query tab.

Search query in Ajax Search widget

3 Step — Customizing the Custom Fields block

Now uncover the Custom Fields tab in the Content section of the settings. Here there are Show Meta Before/ After Title and Show Meta Before/ After Content options, which have the same adjustments. You can enable the appropriate option (options) for displaying extra information from the meta fields in the search results. Moreover, you can determine the position of the meta fields.

After that, proceed to create a meta fields list with as many items as you need just clicking the +Add Item button.

Item #1 appears by default and you can customize it according to your requirement by clicking it. The settings windows will show up. In the Key field, you need to insert the meta key from the post meta table in the database. The Label option allows defining the label text. In the Value Format string, you can insert value format (using HTML markup), %s is meta value.

You can use the Prepare meta value with callback option for the correct display of the date, URL, and images.

In our case, there is a _price meta field and we want to display the data from it.

_price meta field
Custom Fields content settings in Ajax Search widget

4 Step — Viewing the result

Let’s check how it works.

Ajax Search widget

Hope, this tutorial was useful for you.

Display custom fields in the search results easily with the Ajax Search widget.