Help Center

How to Use Hidden Filter with Components

Learn how to use JetSmartFilters’ Hidden Filter with JetEngine’s Components feature on your WordPress website.

Before you start, check the tutorial requirements:

Hidden Filter is the JetSmartFilters’ feature that allows modifying the query that has already been applied to its provider. Refer to the Hidden Filter Overview for more information about its settings.

In this guide, we will show how to use the Hidden Filter with JetEngine’s Component to dynamically change which posts are displayed in the Listing Grid based on the value selected in a Component control.

For instance, you can let users select a taxonomy term within the component and automatically display only the posts associated with that term. You can also adjust the available options in other multi-select filters based on the selected value in the component. This approach maintains query stability even when additional filters are applied within the component.

Things to know

This guide is recreated with the BaliRento dynamic template.

Create Taxonomy

Initially, we built a custom “Property Type” taxonomy for the “Properties” Custom Post Type (CPT), added terms, and attached posts to them. This taxonomy will later be used as a source for the Hidden Filter.

Additionally, we add the “Meals” taxonomy, create terms, and attach posts to them. We will use this taxonomy as a source in a Checkbox Filter, which will also be displayed in the component.

Check the detailed guide on How to Create a Custom Taxonomy.

taxonomy terms

Build a Listing Template

Next, we want to build a Listing item that will be added later in the Component.

Go to WordPress Dashboard > JetEngine > Listings/Components and press the “Add New Item” button.

We leave the default “Posts” Listing source, select “Properties” Custom Post Type in the From post type field, set the Listing item name to “Properties Listing item,” and pick the “Elementor” option as the Listing view (you can use any preferred option).

Click the “Create Listing Item” button to proceed to the editor.

setup listing item pop-up

In the editor, we add dynamic widgets that display post metadata.

dynamic terms in the listing grid

Once the listing item is ready, press the “Publish” button.

Create a Filter

Now, we want to build a filter that will later be added to the Component and applied to the Listing Grid in addition to the Hidden Filter.

Set the Filter Name (here, “Checkboxes Meals”) and select the desired Filter Type. For instance, in this case, we pick the “Checkboxes list” option.

We pick “Taxonomies” as the Data Source and “Meals” as the Taxonomy.

the first part of the meals checkbox filter settings

Also, we set the Filter Labels and press the “Update” button to save the filter.

the second part of the meals checkbox filter settings

Build a Component

Head to WordPress Dashboard > JetEngine > Listings/Components and press the “Add New Component” button.

Set the Component name (here, “Component”) and select the Component view (here, “Elementor.”)

To proceed to the editor, press the “Create Component” button.

setup component pop-up

In the editor, add the Hidden Filter widget to the page. 

In the Content settings, select “JetEngine” in the This filter for selector. 

We want to use the “Property Type” taxonomy as the source, so we select the “Taxonomy” Argument Type and set the Name to “property-type,” since that is the Taxonomy Slug set when creating the custom taxonomy.

In the Value field, paste the %component_control_value|select-tax|||% macro, where the “select-tax” part will be used as the Control Name of the “Select” control we will add to the component a little later. You can use any preferred Control Name, so change it accordingly.

Also, set the Query ID that will later connect the filters and the provider. Here, we type the “listing” Query ID, but you can use any preferred one.

hidden filter in the component editor

Next, we add a Checkboxes Filter to filter content further, not only by the “Property Type” taxonomy in the Hidden Filter, but also by the “Meals” terms.

Pick the created filter in the Select filter field and select the “JetEngine” provider in the This filter for field.

Also, we set the Query ID to “listing” to connect this filter to the Listing Grid.

Make other changes if needed.

meals checkbox filter in the component

Add a Listing Grid widget to the page.

Pick the built Listing and adjust other General settings if needed.

general settings of the listing grid in the component

If you have set the Query ID in the filters, let’s connect them to the Listing Grid

Open the Advanced tab and paste the same value in the CSS ID field (here, “listing.”)

advanced settings of the listing grid in the component

When all the widgets are added, we press the “settings” button next to the component name.

Open the Component Content Controls tab, then press the added “Text Control” to edit it.

Set the Control Label (here, “Select Taxonomy”) and the Control Value. Here, we set the Control Value that was used in the Hidden Filter macro to pass the selected taxonomy term to the Listing Grid, “select-tax”.

Pick the “Select” Control Type and move to the Options textarea field.

Here, set the needed options in the “1::Red” format, where “1” is the term ID and “Red” is its label.

For example, we add such options:

“bungalow::Bungalow

cottage::Cottage

house::House

resort::Resort

villa::Villa”.

These correspond to the terms’ Slugs and Names (names can be changed if desired, but the slugs should remain the same, as they connect the filter, Listing Grid, and terms).

We also set the “cottage” ID as the Default Value, so this option will be selected by default in the Component settings.

component control settings in elementor

Press the “Publish” button when the component is ready.

Add the Component on the Page/Template

Open the page or template where you want to use the component. In this tutorial, we head to WordPress Dashboard > Pages > Add New and open the Elementor page builder.

Find and add the component you have built before to the page. 

You will observe the added component control in the settings. In our case, the Select Taxonomy. In this field, select the desired property type. We leave the default “Cottage.”

component settings in elementor

Adjust other settings, and whenever you are ready, press the “Publish” button.

Check the Result

Open the built page/template on the front end. Since we set the property type to “Cottage,” we see options associated with this term.

listing filtered with the hidden filter

Select one or more filter options to see if it works.

Now, our Listing Grid shows only cottages with the “Self Catering” meal type.

listing filtered with the checkbox filter

That’s all; now you know how to use JetSmartFilters’ Hidden Filter with JetEngine’s Components on your WordPress website.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

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

Start a live chat

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