Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [filtering]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
237 views

Make external links open in new tab, while internal not?

I've been going around in circles wondering which way to tackle this, so thought I'd ask while trying things out in case there's a really obvious way staring me in the face! I have tens of thousands ...
Emma Swann's user avatar
1 vote
1 answer
223 views

How to filter a categories query

I have a categories group named "Title" in my backend. In that group I have 15 categories, but I want to display only 3 specific categories on the frontend. How can I filter my query and ...
Ronny Peaky Scofield's user avatar
2 votes
1 answer
116 views

Filtering lists of entries in the control panel by entry type

I’m aware of Filtering/searching for entries by category in the control panel, but that doesn’t work for: entryType:"String" …where ‘String’ is the entry type name or handle, or… typeId:Int ...
Jonathan Schofield's user avatar
1 vote
1 answer
443 views

Filter entries based multiple category groups

This is related with Split categories by levels / List categories merged by name which I explain more on detail there, after that I take the suggestion of create separate category groups, so: I have ...
user15280052's user avatar
1 vote
1 answer
97 views

Filtering entires via tag field and checkbox field using a form

*** Edited the question I have a code that used to work fine on Craft 2 and I don't understand what I need to change to make it work on Craft 3. I am using form to filter through a channel of entries ...
LessMore Creative Studio's user avatar
1 vote
1 answer
58 views

Craft Commerce: Filter completed orders based on a product category field

I know how to filter entries or products based on a category field with .relatedTo, but how can I filter completed orders based on a product category field? In this specific case, I have an overview ...
MetaMachine's user avatar
2 votes
2 answers
949 views

How to create a faceted search/facet filter in Craft Commerce

I want to create these kinds of filters on my Craft Commerce site: I have poked around with the Faceted Navigation plugin, but haven't gotten it to work the way I want yet (posted an issue about high ...
nitech's user avatar
  • 679
1 vote
1 answer
601 views

orderBy title, but remove the word "The" from titles

If I have a huge list of TV shows and Movies, many of them have "The" in the title, meaning they all get grouped together if you order by title. Is it possible to "filter out" a ...
MarkD's user avatar
  • 85
1 vote
1 answer
42 views

Using a Matrix field to create a homepage that shows entries from sections and categories

I have set up 3 channel types - A, B & C and a Category. Each entry type shares the same pool of categories. On the home page, I have created a Matrix field (homeSections) with a block type ...
MarkD's user avatar
  • 85
1 vote
0 answers
142 views

Sanitize form input

I'm trying to sanitize form input values in my plugin. Yii2 framework provides the following validation method: https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators#filter It says ...
Alex89's user avatar
  • 183
1 vote
1 answer
69 views

Order grouped results by dropdown order

Following this topic, I have an additional question. The results are not ordered by the order of the Dropdown Options. How can I get this done? Code: {% set players = entry.myPlayersMatrix %} {% ...
levinDan's user avatar
1 vote
0 answers
31 views

Filtering Entries based on Amenities (Category)

Hello and thank you in advance. I have a page that lists hotels by region. On the initial load of the page I am able to render all the hotels by region in a tabbed format. This part of the page works ...
Jason's user avatar
  • 107
1 vote
1 answer
330 views

How to use checkboxes to filter categories on the front end?

i am trying to filter the various categories i have. Currently my url formats the following : www.site.com/news?cat=industry-news&cat=architecture-design I understand that i have to change this ...
Shahyn Kamali's user avatar
1 vote
2 answers
1k views

Arrow functions in twig or craft cms

I tried to use reduce function in template, but got error. It seems twig/craftcms can not work with such functions. Reduce function docs: https://docs.craftcms.com/v3/dev/filters.html#reduce My ...
g1un's user avatar
  • 81
5 votes
1 answer
1k views

How to order or filter entries by their author's custom field?

Is it possible to order and/or filter all entries from a section whose author has a custom field value that is set to "X"? Below is the starting code. in Twig: {% set elementQuery = craft.entries()...
Ben Croker's user avatar
  • 7,526
1 vote
1 answer
746 views

Filter Entries by Category fields & refresh URL and list with AJAX

I'm finding myself stuck with filtering entries that are related to categories using a category field. I'm looking to build a sub-navigation on a page, where I can select from a select field or from a ...
mateostabio's user avatar
1 vote
1 answer
266 views

How to filter entries by tags array using ['or'] and by category not using or

This works for filtering by tag array {% set relatedToParam = ['or'] %} {% for id in selectedTagIds %} {% set relatedToParam = relatedToParam|merge([{ targetElement: id }]) %} {% ...
Martin's user avatar
  • 11
1 vote
1 answer
513 views

Product Filtering with Tags

I've built a product filtering system using tags and currently have 2 available tag groups under different fields. Size and Type Currently if I select 1 tag from both size and type, it shows all ...
Amy's user avatar
  • 407
0 votes
0 answers
56 views

Using relatedTo with a string of category ids

I have got a list of product variants being filtered by a string of category ids if there is some data in the category parameter with the following code: (Note that I'm using the + character between ...
Jay's user avatar
  • 1,042
1 vote
1 answer
209 views

filter matrix blocks by multiple light switch value, and then merge them

I have a (Craft 3) matrix field with two different block types that each have a similar light switch field that I want to use to create anchor links on my page. I need to be able to test whether any ...
artmem's user avatar
  • 1,022
2 votes
2 answers
2k views

Filter entries by Field value using a variable

How do I filter a list of entries by the value of a field using the value of a variable? e.g. {% set location = block.locationVacancies %} {% set entries = craft.entries.section('careers').search('...
user9247's user avatar
1 vote
2 answers
232 views

Filtering by categories AND tags with full match

We're trying to filter by categories AND tags in the one form. However can't seem to get things working as we would like. Essentially, we have a form that pulls in the tags and allows multiple ...
James N's user avatar
  • 21
1 vote
0 answers
171 views

Redactor has destroyed my mailto links, now what?

I migrated from EE > CraftCMS. The email links in my EE WYGWAM fields were encoded as JS. When we imported to CraftCMS we lost all of those links. They now look like this: <a>[email protected]</...
Vaughn D. Taylor's user avatar
1 vote
0 answers
773 views

How can I filter with facets in algolia with nested structures?

I have a site that currently uses a structure where we have a parent entry and children under it. On the parent page we have entries that have been created with matrix blocks. The structure is as ...
M dunbavan's user avatar
1 vote
2 answers
523 views

Sort entries by time part only of DateTime object

I am trying to filter and sort show entries by what time they begin display the current show I have two fields, startTimeand endTime, and while Craft lets me display only the time part in the ...
Joshua's user avatar
  • 61
1 vote
1 answer
977 views

Pass 'not' category.id to relatedTo in Craft

I have a search page that filters with these params: {% set results = craft.entries({ section: 'properties', price: range, search: query.location, relatedTo: status, order: ...
Joshua's user avatar
  • 61
1 vote
1 answer
418 views

How can I filter Craft Commerce products by the current price

Building on from this question How can I filter Craft Commerce products by price I have a price filter in the store Using this code works fine for the normal price {% set queryParams = { ...
MalTek's user avatar
  • 116
2 votes
1 answer
729 views

Only show entries related to category

I am trying to create a category template that shows all entries to show relating to the categories. At the minute the cats are Industry Chemical Medical
FEDev's user avatar
  • 35
1 vote
1 answer
856 views

How can I filter Craft Commerce products by price

I'm trying to use price as a parameter for filtering my Craft Commerce products, but I cannot get it to work. I think the problem is with the way that I'm referring to the product price, but at the ...
celeste.nexus's user avatar
1 vote
0 answers
388 views

How to add pagination to a filtered category output?

I've been able to successfully filter a set of entries by category, and also include pagination for the complete set of entries (in this case so 6 are displayed per page). But once a category filter ...
MGX's user avatar
  • 479
2 votes
1 answer
549 views

Display entries that meet multiple tag params

how would I go about setting up a route and twig template to filter by multiple tags? Example URL scheme: example.com/tags/tag1/tag2/tag3 where tag1, tag2 and tag3 are tags defined in a tag field ...
Markus's user avatar
  • 23
4 votes
1 answer
393 views

Filtering on related entries (with an array query param)

I'm getting myself into a potential pickle here and wanting to know the best way to get apply filters on the current scenario: I have a central business section which is getting populated via an API (...
Darren Wood's user avatar
10 votes
4 answers
18k views

Filter Entries by Field Value

How do I filter a list of entries by the value of a field? For example, if I have a lightswitch field called "Featured", how do I output just the featured entries?
kmgdev's user avatar
  • 1,199