Note: These shortcodes are also available as Gutenberg blocks. You can configure the block without using any code or parameters. Read more about the block options.
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 Dynamic Post Filter.
If you don’t know what is a shortcode and how to use it, you first may want to read this article.
You find here the overview of all shortcodes for the Toggle Post Filter.
- string: A text. For identifiers that won’t be visible to visitors you often have to replace spaces with _ or -. If the string contains spaces, you need to wrap it in quotes.
- integer: A number without decimal places.
- 0 or 1: 0 turns the feature off and 1 on.
Hide tags that are not being used in (public) posts.
accepted values | default | example shortcode |
---|---|---|
integer | 1 (on) | hide_empty=0 |
How the tags should be logically connected. Possible values are “IN”/”OR” (At least one tag matches.), “AND” (All tags match.), “IN AND” (At least one tag from each group matches) or a per-group definition:
operator="all:OPERATOR|group ID:OPERATOR|group ID:OPERATOR| ..."
Remarks about the per-group notation:
- You need at least one entry with the keyword “all”. The corresponding operator determines how the groups are connected.
- OPERATOR can be AND or OR (upper or lower case). IN is an alias of OR.
- The order of groups doesn’t matter.
- If you use this format of the operator, all groups that you don’t specify will fall back to the operator OR.
accepted values | default | example shortcode |
---|---|---|
string | IN/OR | operator="IN AND" operator="all:and|1:or|5:or|3:and" |
See the information under Preset Tags.
accepted values | default | example shortcode |
---|---|---|
string | none | preset_tags="tag-slug-1,tag-slug-2" |
Lets you determine the order of the tags (terms). You can modify the tags’ slugs or descriptions in order to achieve the required order.
option | description |
---|---|
name | tag name |
natural | natural sorting, e.g. “3” before “12” |
slug | see on the Tags page |
term_id | term ID |
description | see on the Tags page |
count | post count |
term_order | A custom sort order is available with a 3rd-party plugin. |
accepted values | default | example shortcode |
---|---|---|
string | name | term_orderby=natural |
Whether to sort the tags in ascending or descending order.
accepted values | default | example shortcode |
---|---|---|
string (“asc” or “desc”, capitalization doesn’t matter) | ASC | term_order=asc |
Restrict the tags only to these taxonomies. Available are only taxonomies that have been activated in the Settings.
accepted values | default | example shortcode |
---|---|---|
comma-separated list of taxonomy names | Taxonomies selected in the settings under “Basics”. | taxonomy=post_tag,product_tag |
Select terms (tags) that should be included. Empty means all.
accepted values | default | example shortcode |
---|---|---|
comma-separated list of integers | empty (=all) | include=1,5,9 |
Select terms (tags) that should be excluded. Empty means none.
accepted values | default | example shortcode |
---|---|---|
comma-separated list of integers | empty (=none) | include=1,5,9 |
Optionally filter also by terms (tags, categories, …) of an additional taxonomy (not necessarily one of the taxonomies used for tag groups). That way you can narrow down the total sample of filtered posts.
Used together with static_terms.
accepted values | default | example shortcode |
---|---|---|
string | none | static_taxonomy=category |
Used together with static_taxonomy. This parameter lists the IDs of the additional tags, categories, … that should be present in all posts used by the filter.
accepted values | default | example shortcode |
---|---|---|
comma-separated list of integers | none | static_terms=42,255 |
Display the menu as an accordion. Please note that also hidden toggle switches are effective.
accepted values | default | example shortcode |
---|---|---|
integer | 0 (off) | accordion=1 |
Tag groups that will be shown to visitors. Groups without tags will be hidden.
In the short code you use the IDs, which you find in the left column in the list of groups. Empty or not used means that all tag groups will be used.
accepted values | default | example shortcode |
---|---|---|
comma-separated list of integers | empty (=all) | include=1,5,9 |
Tag groups where visitors can select only one tag. All of these groups must of course be available in the filter.
In the short code you use the IDs, which you find in the left column in the list of groups. Please note that more tags might still be selected if this selection is carried over by the persistent filter setting from another page.
accepted values | default | example shortcode |
---|---|---|
comma-separated list of integers | empty (=none) | one_only_groups=1,5,9 |
- classic: The menu items appear vertically stacked in a narrow container. Posts have space to display on the right side. If you select “classic” for the menu, also the body part with the posts should use the “classic” layout.
- button: Like the classic layout, but instead of toggles we use buttons. Optionally show an icon on active buttons.
- classic_tags: The menu is arranged like the classic layout. Tags appear in a tag shape and line up in rows (like in tag clouds).
- wide: Groups are lined up horizontally. Posts should display below the menu. If you select “wide”, the post layout can be any of wide, boxed, columns, columns-avoid-break and masonry.
- wide_button: Like the wide layout, but instead of toggles we use buttons. Optionally show an icon on active buttons.
- wide_tags: The menu is arranged like the wide layout. Tags appear in a tag shape and line up in rows (like in tag clouds).
- slider_left: The menu slides in from the left side, covering the contents of the page. The slider remains open while you click on the buttons so that you scroll through the search results while the menu remains open. Consider composing the page in a way that the slider doesn’t cover the posts. You close the menu by clicking on the X or outside the slider.
For the slider you will also need the button to open the slider.
The default slider uses buttons with optional icons. - slider_left_tags: The menu is arranged like the slider_left layout. Tags appear in a tag shape and line up in rows (like in tag clouds).
- slider_right: The same as the left slider, opening from the right.
- slider_right_tags: The menu is arranged like the slider_right layout. Tags appear in a tag shape and line up in rows (like in tag clouds).
accepted values | default | example shortcode |
---|---|---|
string | classic | layout=wide |
Use the identifier (the part in lowercase letters with dashes) to place an icon on active buttons. (Not available with toggles.)
often used: dashicons-tag, dashicons-yes, dashicons-yes-alt, dashicons-heart, dashicons-arrow-left, dashicons-arrow-right, dashicons-thumbs-up
accepted values | default | example shortcode |
---|---|---|
string | empty | icon_class=dashicons-tag |
Set the width of the slider menu in pixels. Only available with the slider_left_tags and the slider_right_tags menu layouts.1
accepted values | default | example shortcode |
---|---|---|
integer | 600 | slider_width=300 |
Set the background color of the tags. Only available with the classic_tags, wide_tags, slider_left_tags and the slider_right_tags menu layouts.
accepted values | default | example shortcode |
---|---|---|
string | 600 | tag_color="#ddd" |
Set the background color of the tags that are toggled on in the filter. Only available with the classic_tags, wide_tags, slider_left_tags and the slider_right_tags menu layouts.
accepted values | default | example shortcode |
---|---|---|
string | 600 | selected_tag_color="#d00" |
Available are “light” and “dark”.
accepted values | default | example shortcode |
---|---|---|
string | light | theme="dark" |
Time in minutes that results remain in the cache.
accepted values | default | example shortcode |
---|---|---|
integer | 10 | caching_time=10 |
The Toggle Post Filter can optionally remember the selection of groups and tags so that your visitors who clicked on an article and then return to this page will see the same list of articles again. If now post has been clicked, the page will scroll to the group selection menu. (Otherwise the browser might go to a random post, depending on the loading speed.)
The data is saved in a browser cookie. If you are using this filter more than once on your site, you should use different values for div_id so that each filter uses a different cookie.
The value is the time in minutes. Zero means off.
accepted values | default | example shortcode |
integer | 0 (off) | persistent_filter=30 |
Enable text search and determine when the search should start.
0: off
1: launch by pressing enter
2: launch by pressing enter or pause typing
accepted values | default | example shortcode |
---|---|---|
integer | 0 | text_search=2 |
Placeholder message for the text search field.
accepted values | default | example shortcode |
---|---|---|
string | “type here” | placeholder_text_search="try word or -word" |
You can set here classes to be referred to in CSS. You need some knowledge of CSS to use these options.
Define a class for the <div>.
accepted values | default | example shortcode |
---|---|---|
string | dpf_toggle_menu_light | div_class="dpf_toggle_menu_dark" |
Define an ID for the enclosing <div>.
accepted values | default | example shortcode |
---|---|---|
string | empty | div_id="my_own" |