Croco Black Friday 2024 banner element
Copy discount code:
bfcroco2024
Days
Hours
Minutes
Croco Black Friday 2024 banner element
Help Center
How to Change Banner After Filtering Categories

How to Change Banner After Filtering Categories

This tutorial describes how to change the banner on the front end after filtering by category using the JetSmartFilters and JetEngine plugins on your WordPress website.

Before you start, check the tutorial requirements:

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

  • JetSmartFilters plugin installed and activated

  • JetEngine plugin installed and activated

To set up the banner, we will go through the following steps:

  • Creating custom taxonomy, each term of which will have a customized banner. For that, we will add the needed custom fields to the taxonomy;
  • Creating a filter with the taxonomy source;
  • Setting a custom query to apply it to a listing. It will show the required banner according to the option chosen in the filter;
  • Creating a listing template that will match the banner look. For instance, we will display the icon and slogan;
  • Placing the filter, listing with banner, and listing with posts that need to be filtered by category on the front end.

As an example, we will create banners for the following vacancy types: full-time, part-time, internship, and volunteer. The “Vacancy Type” will be a custom taxonomy for the “Jobs (Vacancies)” Custom Post Type.

banner is visible after filtering by category

Creating Custom Taxonomy

To create a custom taxonomy if you haven’t done it yet, proceed to the WordPress Dashboard > JetEngine > Taxonomies tab and hit the “Add New” button.

In the General Settings tab, type the Taxonomy Name (in our case, “Vacancy Type”), click the Taxonomy Slug field to generate a slug (you can edit it, but ensure it contains only letters, numbers, and `-` or `_` chars), and choose the needed Post Type from the namesake drop-down list (in our case, “Jobs (Vacancies) CPT).

custom taxonomy creation

In the Meta fields settings tab, you can add the desired custom fields. For instance, we crafted the “Media” meta field for the vacancy-type icons that will be added to the banner.

media custom meta field for the taxonomy icons

The essential taxonomy settings for this tutorial are covered. You can adjust other settings if you like — the detailed description is provided in the Custom Taxonomy Overview.

Push the “Add/Update Taxonomy” button after customization.

Then, go to the tab with the taxonomy name that belongs to the post type tab. For example, we visited WordPress Dashboard > Jobs (Vacancies) > Vacancy Type

To add a new tag, enter the Name, Slug (ensure it’s all lowercase and contains only letters, numbers, and hyphens since it’s the URL-friendly version of the name), Description (optional), and fill in the needed meta fields. Then, press the “Add New Tag” button. 

For example, we added a slogan as the Description and icon in the custom “Media” field.

After filling the fields, push the “Add New Tag” button.

Add as many tags as you require.

adding new tags to the custom taxonomy

To attach posts to the tags, proceed to the CPT tab on the WordPress Dashboard and click to edit a post or create a new one.

attaching posts to tags

Save the changes by clicking the “Publish/Update” button.

Creating Filter for Category

Head to the WordPress Dashboard > Smart Filters > Add New tab to create a filter for categories.

Enter the Filter Name and pick the Filter Type. For the taxonomy data source, you can choose “Select,” “Radio,” “Checkboxes list,” and “Visual” filter types.

We created the “Radio” filter so that users can choose only one option from the filter on the front end. The “Select” filter is also suitable for our case. If we created the “Checkboxes list” filter, the user could select two or more options, and several banners would be displayed simultaneously. The “Visual” filter can have the behavior of either a radio or a checkbox.

After choosing the filter type, select the “Taxonomies” Data Source and choose the needed Taxonomy (“Vacancy Type,” in our case).

taxonomy data source for the checkboxes list filter type

After that, you’re free to adjust options according to your needs.

For example, we enabled the Ability to deselect radio buttons and Show empty terms toggles, and set Filter Labels in the corresponding section.

radio filter settings

After adjusting the filter settings, push the “Update” button.

Setting a Custom Query

Follow the WordPress Dashboard > JetEngine > Query Builder directory and press the “Add New” button.

In the General Settings section, enter the Name and pick the “Terms QueryQuery Type.

Warning

Set the Query ID that will not match the Query ID used in filter settings (e.g., “no-filter” or “never-filter”). Doing so ensures that filters on the page do not interfere with the query operation. Instead, we will attach the query to the filter using the “JetSmartFilters Query” macro.

query general settings

In the Terms Query section, proceed to the General tab and choose the needed Taxonomy.

taxonomy for the terms query

Open the Include/Exclude tab, press the “coin stack” icon next to the “Include” field, and select the “JetSmartFilters Query” macro.

In the opened pop-up, pick the “Taxonomy” Type and enter the taxonomy slug as the Variable Name.

jetsmartfilters query macro

Click the “Advanced settings” link, keep the “Default Object” Context, and enter “9999999” into the Fallback field. Doing this ensures that the listing with the query source will show the result only when the filter is applied. In other words, without the fallback, the banner listing will show all terms; setting the fallback ensures that the banner will be invisible until an option from the filter is chosen.

fallback in the jetsmartfilters query macro advanced settings

Then, hit “Back” and the “Apply” button.

Adjust other query settings if you fancy and hit the “Add/Update Query” button.

Creating a Listing

Head to WordPress Dashboard > JetEngine > Listings and click the “Add New” button.

Pick the “Terms” Listing source, set the needed taxonomy in the From taxonomy field, and enter the Listing item name. As the Listing view, you can select Elementor, Blocks (Gutenberg), or Bricks editors. For example, we chose the “Elementor” option.

Press the “Create Listing Item” button to open the editor.

listing template with query builder source

Here, you can customize the template to match the banner look. For instance, we drag-n-dropped the Dynamic Image widget and set the custom taxonomy “Media” field as the Source.

dynamic image with the custom taxonomy media field source

Then, we placed the Dynamic Field widget, for which we selected the “Post/Term/User/Object Data” Source, “Term description” Object Field, and “H2” HTML tag.

dynamic field displays term description

To put the banner in the frame, we opened the Style settings of the Section settings, unfolded the Border tab, and set the “Solid” Border Type. You can customize other style settings for the listing’s section, columns, and widgets if interested.

listing section border style settings

After adjusting all settings, we hit the “Update” button.

Customizing a Banner on the Page

Create a new page or open the needed one.

For instance, we went to WordPress Dashboard > Pages > Add New Page, typed the page name, and hit the “Edit with Elementor” button.

We placed the Listing Grid widget on the top of the page, chose the recently created Listing for the banner, and set the “1” value as a Columns Number.

After you apply a custom query to the Listing Grid, it will show the Not found message. You can leave this field empty to make the widget invisible until the filter is applied or set a custom message.

listing grid widget

Then, we unfolded the Custom Query tab, enabled the Use Custom Query toggle, and picked the recently created Custom Query.

applying the custom query to the listing grid

We opened the Advanced settings section and typed the CSS ID (e.g., it can be “banner-list”). We will use this ID in the filter settings later.

CSS ID for the Listing Grid widget

Next, we added two Columns and placed another Listing Grid to the second column. Here, we selected the Listing with vacancies created for the “Jobs (Vacancies)” CPT. To learn more, proceed to the How to Create a Listing Template for Post Types in Elementor tutorial. 

listing grid with vacancies

We opened the Advanced settings section and typed the CSS ID as well (in our case, it’s “main-list”).

CSS ID for the Listing Grid with jobs

Eventually, we drag-n-dropped the Radio Filter widget. If you created the “Select” filter, you need to use the Select Filter widget respectively.

In the filter Content settings, we set the needed filter in the Select filter field.

The This filter for field is for the filter’s main provider. In our case, it’s the Listing Grid with vacancies, so we picked the “JetEngine” option. Learn what widgets, blocks, and elements can be used with the JetSmartFilters filters from the Filters Providers Overview.

Optionally, we set such settings: picked the “AJAX” Apply type and “Value change” Apply on and enabled the Show filter label toggle.

Things to know

Since we set the “AJAX” Apply type, the “Apply” button is unnecessary, so we kept the toggle disabled. With the “Page Reload,” the “Apply” button should be used.

In the Query ID field, we entered the CSS ID of the main provider widget (in our case, it’s the “main-list” of the Listing Grid with vacancies).

To attach the filter to the Listing Grid with banners, we activated the Additional Providers Enabled toggle and pressed the “+ Add Item” button. Since the second provider is also a Listing Grid, we chose the “JetEngine” Additional Provider. Into the Additional Query ID field, we pasted the CSS ID (“banner-list,” in our case).

radio filter with additional provider

To learn more about the Additional Settings tab, proceed to the Additional Settings chapter of the Radio Filter Overview.

You can also set the Indexer Options. For that, we activated the Apply Indexer and Show Counter toggles. The counter will work correctly on the front end after applying the filter.

indexer options for the radio filter

The essential settings have been adjusted, so you can now customize the style settings. 

For instance, to customize the filter label, we opened the Style section tab of the Radio Filter widget and unfolded the Label tab. We clicked the “pencil” icon near the Typography to open a popup. Here, we set the “20” Size, “600 (Semi Bold)” Weight, and “40” Line Height.

filter label style settings

After modifying all needed settings, hit the “Publish/Update” button.

Checking the Results

We opened the page on the front end. The banner hasn’t been shown since the filter hasn’t been applied yet.

filter and listings on the front end

After we picked an option from the Radio Filter (the “Full Time” category), the appropriate banner appeared.

banner is visible after filtering by category

After we selected another option (the “Internship” category), another banner appeared.

internship jobs selected

That’s all. Now you know how to change the banner on the front end after filtering by category using the JetSmartFilters and JetEngine plugins on your WordPress website.

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.