Active Filter Link
By default, the Divi FilterGrid plugin will show all posts with the All filter button active. You can change this behavior using an option in the module’s settings or by using a special URL.
Default Filter Option
Found within the Content tab and Filter Options section of the module’s settings, the Default Filter option will allow you to set any category, tag or other term as the default filter. Simply click on the input in the module and select the term you would like to set as the default filter. Unlike the URL option below which allows you to set different default filters using URL parameters, the Default Filter can only set one default filter.
URL Option
The URL option allows you to change the default filter by adding the term ID to the URL like below:
http://example.com/?dfg_active_filter=categoryID
Make sure you replace “categoryID” above with the actual numerical category or term ID. If your category ID is 7, your URL will look like this:
http://example.com/?dfg_active_filter=7
If you need to enter multiple filters (MultiSelect or MultiLevel needs to be turned on), you can separate the term IDs with the pipe character like this:
http://example.com/?dfg_active_filter=7|22|34
Assuming the layout contained posts in that category, those posts would be the only ones displayed when the page is loaded and the filter button for that category would be active. You’ll still be able to view posts in other categories by clicking on the other filter buttons. With the URL option, you can create as many URLs as you want to change the default filter.
If you are having trouble finding the category/term ID, you can easily find it using the following methods:
- View the page that contains the Divi FilterGrid module and right click on the filter you would like to be active. Left click on “Inspect” or “Inspect Element” in the dropdown that appears. You should now see the HTML for the filter you right-clicked on. You should see something similar to the screenshot below: The number you’re looking for is the data-term-id value. In the example above, this value is 7.
- You can also find the category ID by logging into your WordPress site and clicking on Posts -> Categories. If you’re displaying a Custom Post Type, click on the Categories menu for that custom post type. For example, Products -> Product Categories. Once you’re on the categories page, hover your mouse over the category you want to get the ID for. In the bottom left corner of your browser, you should see a long URL with tag_id= followed by a number which represents the ID.