Help Center

How to Filter CCT Items by Date of Creation and Modification

In this guide, you will find out how to create JetSmartFilters’ “Date Range” and “Date Period” filters that will filter JetEngine’s Custom Content Type items by date of creation or modification.

Before you start, check the tutorial requirements:

Filter by Creation Date

Initially, let’s add a filter by the Custom Content Type items creation date.

Create a filter

Head to WordPress Dashboard > Smart Filters > Add New to build a new filter.

Name a filter (in our case, “Date Range” Filter Name) and select the “Date Range” or “Date PeriodFilter Type. Now, we pick “Date Range.”

In the following Filter by selector, pick the “Meta Date” option.

Work on the following settings if desired.

date range filter settings

Now, pay attention to the Query Variable field. In this field, paste the “cct_created” macro.

Things to know

This value should be manually written and not selected from the “Dynamic tag” macros list.

Also, complete the Filter Labels section and ultimately press the “Update” button to save the filter.

date range filter query variable and filter labels

Build a listing template

Next, we should build a Listing template for the CCT we work with.

To do this, we go to WordPress Dashboard > JetEngine > Listings/Components. Here, press the “Add New Item” button.

In the opened pop-up, select “Custom Content Type” as the Listing source, select the needed CCT in the From content type dropdown, name the listing in the Listing item name field (in our case, “Tour Location Listing”), and pick the Listing view (now we select “Elementor.”)

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

set up listing item pop-up

In this Listing template, we place the Dynamic Field widget with the CCT item’s “Location Name” (a “Text” meta field) and the Dynamic Image widget with the “Location Image” (a “Media” meta field). Add the widgets you need.

When all the needed widgets are added, publish the Listing template.

dynamic image widget in the listing item

Add the filter and the listing to the page

Now, proceed to the page/template where you want to place a filter and a listing.

Add a Date Range Filter/Date Period Filter widget to the page. In the Select filter field, pick a filter you built earlier and the “JetEngine” option in the This filter for field.

Make other changes to the widget if desired.

date range filter in elementor

Now, add a Listing Grid to the page. In the Listing field, select a Listing template you have built. 

Work on the other Listing Grid settings and, when the page is ready, save it.

listing grid widget with the date range filter

Check the result

Now, it’s time to check the result. Proceed to the front-end page you have just edited.

date range filter on the front end

Select the dates to check the CCT items that were created during this time period, and if everything works fine, you will see the filtered listing.

listing grid filtered by date range

Filter by Modification Date

Now, let’s check how to build a filter by the CCT item modification date.

Create a filter

Navigate to the WordPress Dashboard > Smart Filters > Add New dashboard.

Complete the Filter Name (here, “Date Period”) and pick the Filter Type: “Date Period” or “Date Range”. Now, we select the “Date Period” option.

In the Filter by dropdown, pick the “Meta Data” option and change the Period Type if needed.

Work on other settings fields if desired as well.

date period filter settings

Then, scroll down to the Query Variable field and paste the “cct_modified” value in there manually.

Ultimately, complete the Filter Labels in the same-named section and save the filter by pressing the “Update” button.

date period filter query variable and filter labels

Build a listing template

Now, build a listing for CCT items if you haven’t done so. We have built one already; check the instructions in the Building a listing template chapter of this guide.

Add the filter and the listing to the page

Navigate to the page/template where you want to place the filter and the Listing Grid.

Add a Date Period Filter/Date Range Filter widget to the page. 

Pick the built filter in the Select filter field and the “JetEngine” provider in the This filter for selector. Work on other widget settings if needed.

date period filter in elementor

Now, add a Listing Grid widget to the page. 

Select the pre-built Listing and make the necessary changes to the ListingGrid and the page itself, then save the page.

listing grid widget with the date period filter

Check the result

Now, proceed to the front-end page to check the result.

date period filter on front end

When the needed dates are selected, the Listing Grid will be filtered.

listing filtered by date period on the front end

That’s it; now you know how to filter JetEngine’s Custom Content Type items by date of creation and modification with the help of the JetSmartFilters plugin for WordPress.

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.