By Anne White
With PageBox filter atoms, you can easily create a simple and effective filter to help your users find relevant posts. Being able to filter posts by categories, or other taxonomies, will improve the usability of your site, as users no longer have to trawl through every post on your site to find what they are interested in. Quick and easy filtering options also remove the need for separate landing pages for different taxonomies, meaning that all of your posts can be displayed and filtered on a single page.
Posts can be displayed on the page by insights atoms. Therefore, in order to use a filter atom to filter posts, you first need to apply an insights atom to your page. See our “Controlling featured insights” guide for more information on why and how you might use insights atoms.
Once you have added the insights atom to the page, you can then add the filter atom. There are a number of different filter atoms available depending upon the design and functionality of the filter. Each atom will have slightly different features; therefore, it is a good idea to consult the individual filter atom user guide when adding the atom to the page.
Once you have added both atoms to the page, you will need to link them together so that the insights atom can be filtered. In order to do this, you will need to enter the same value into both the module ID of the filter atom and the filter ID of the insights atom.
Every atom has a module ID field within their atom screen, into which a value can be added that will allow you to relate atoms to each other.
Insights atoms, and other atoms that can be filtered, will also have a separate field called filter ID, which is different from the module ID. Atoms that cannot be filtered will not have this field.
In order to link the filter atom with the insights atom, an identical value must be entered into the module ID field of the filter atom and the filter ID field of the insights atom. You can use any value as long as it is exactly the same in both atoms. As an example, you could enter the value “filter_01” into the module ID of the filter atom.
Then enter the same value into the filter ID of the insights atom.
It is very important that you ensure that the value is entered into the filter ID of the insights atom and not the module ID. If the value is entered into the module ID of the insights atom, the insights and filter atoms will not be connected.
Once you have connected the two atoms, you must also ensure that the correct content is being filtered. Choose the post type and taxonomy that you would like to be filtered from the dropdown field within the filter atom screen. For example, if the insights atom is displaying posts, and you would like those posts to be filtered by category, choose “Categories (post)” from the dropdown menu.
Filters will be able to filter multiple atoms, as well as atoms from anywhere on the page, as long as they are connected through their filter and module IDs. Therefore, it is possible to have a filter atom in a separate row, above or below, or several atoms away from the atom that you would like it to filter.
It is worth noting, that if your insights atom and filter atom are connected, the filter atom will display posts with the chosen post type and taxonomy in the insight atom, regardless of what was originally displayed. For example, if you have an insight atom that has been manually set to pull through six specific posts, but have connected it to a filter atom that is designed to filter posts by category, then all of the posts in the category that is selected on the filter will be pulled through in the insights atom, rather than only filtering the manually chosen posts.
In conclusion, it is an easy process to add and control filters for insights on your site. Simply add both the filter and insight atom to your page, ensure that the two atoms are linked through their module and filter IDs, and choose the correct post type and taxonomy for the filter to pull through. As long as this is done correctly, your users will be able to simply and efficiently search through posts on your site using a filter.