How to provide multiple filters for posts?

The «Posts» element allows to display a taxonomy filter. This gives website visitors the possibility to filter posts by categories, tags, or similar. However, this allows only one single filter, and it filters only by taxonomies.

How would I implement a page which allows to filter posts by
– categories
– tags
– years
– products (= custom field)
in parallel?

1 Like

query editor

image

example

return[
'post_type'      => 'products',
'category_name'  => 'your-category-slug', 
'tag'            => 'your-tag-slug',      
'date_query'     => array(               
        array(
            'year'  => 2023,                
        ),
    ),
'meta_query'     => array(                
	array(
		'key'   => 'custom-field',            
		'value' => 'custom-field-value'           
	),
),
'posts_per_page' => 10,                  
];

I don’t think this is an answer to my question. This is a preconfigured query. What I want to achieve is that website visitors can set their own filter criteria.

oh I see.
I coded something like that before.

I don’t think that’s natively possible “only” with bricks
there is product filters but there is no posts filters yet :slight_smile:
image

I know that there are plugins for this (like https://facetwp.com https://filtereverything.pro https://searchandfilter.com). But I was hoping for a solution that is native to Bricks or only needs a (not too complex) custom function.

Hi

just saying…

WPGridbuilder has a winter sale right now, 30% OFF - Limited Time Deal.

I am very happy with it.

Or you can program it yourself:

Or you wait until Native Sorting & Filtering from the roadmap is implemented.

Cheers

Patric

imagine having dynamic tags worked in class field :slight_smile:

it would be awesome tho isn’t it… so many possibilities.

when this class names are needed like making custom tax filter something
even if we have Interactions SUPERPOWER we just cant build anything because we don’t have dynamic class names.

@thomas :wink:

image

There is light at the end of the tunnel:

1 Like

what I said is possible from ATTRIBUTES O_O

I solved it one day later wrote a custom dynamic tag for custom tax and bricks attr very powerful :slight_smile: