Note: This shortcode or block can only be used once on a page (including widgets), and it cannot be used together with the shortcode or block of the simple Dynamic Post Filter.
The Dynamic Post Filter With Toggles is very similar to the Dynamic Post Filter, the difference being that here all selected tags are displayed as toggle switches. If you turn on a tag, it becomes active for the filter.
The Dynamic Post Filter With Toggles is a good choice if you want to offer a list of tags that easily fits on a screen. It helps your visitors keep an overview of the available filter options.
- For this tool you need to insert three shortcodes: One for the filter, one for the posts and one for the messages about how many posts were found (if you need them). That makes it possible to freely arrange the components in your page layout.
- You can select which groups appear and the tags can be sorted by name, slug, ID, description or count. You can also use include_terms and exclude_terms to fine-tune the available range.
- The filter part can optionally be displayed as accordion: Initially you see only the group names. When you click on them, the panels with the tags slide down. Please note, however, that also hidden toggle switches are effective.
- The persistent filter (parameter persistent_filter) option lets your visitors who clicked on a post and then pressed the back button return to the same post in the same selection of filters. You can define a time how long the filter should remain in memory.
- Also the list of posts for a particular selection of filters is kept in the cache for a time that you choose so that your database won’t have to do the entire search again.
- The Dynamic Post Filter With Toggles comes with two themes – simply use dpf_toggle_menu_light (default) or dpf_toggle_menu_dark as div_class. Or create your own. The toggle switches are HTML checkboxes.
Please note that it is unavoidable that complex queries take some time to process in the database. That is particularly the case if many tags are selected in multiple groups. It is therefore highly recommended to use the parameter caching_time (in minutes) to speed up queries that have appeared recently before.
If you don’t want your visitors to select tags with a toggle (on-off) switch but to enter them into a tag field, you could take a look at the standard Dynamic Post Filter.
If you don’t need the interactivity of a Dynamic Post Filter, you may want to check out the Post List.
You can also use one of the tag clouds. They are highly customizable so that you can, for example, display all tags in the same size or prepend to each the same character. Using the tag clouds, however, visitors don’t see immediately the list of matching posts. Instead, a click on the tag takes them to a “tag page”, where all posts are listed that have this tag.
For all available options, see the list of parameters.
If no tags or no posts appear, please make sure that
- you have selected the correct taxonomy. If you use something else than the default post_tag, use the taxonomy parameter.
- you have assigned your tags to groups and used these tags in public posts (use the Meta Box).
If that still doesn’t help, you may want to try the buttons on the Troubleshooting page.
Demos are available on this page.