Filtering and Conditional Display of Articles
Joomla provides no mechanism for filtering menu items e.g. Category Blog views, based on the value of custom fields. EasyLayouts make this functionality available in Joomla. This article explains how to use this feature.
On the EasyLayouts Demo site (https://demo.easylayouts.net) we showcase EasyLayouts to show how you could set up a site to list chefs, restaurants and recipes with different layouts, custom fields and interrelated linkages. One obvious need when showing recipes is to search for recipes with specific ingredients or allergens. We have a menu item to show this functionality - https://demo.easylayouts.net/recipes/excluding-wheat
This is done using EasyLayouts menu item filtering - EasyLayouts adds a new tab to the menu item editing page 'Custom Field Conditions':
The constraint system starts with a question to say if matching items should be hidden or shown and if ALL or just SOME of the conditions need to matched.
In this case we choose to hide all articles that match ALL the constraints. Looking at the constraints in more detail - the first input allows you to select a specific custom field, the second how the value of this field should be tested
In this case we have selected 'Allergens' and to show/hide the articles when its value is equal to the specified value.
The custom field value field should adjust to take account of the field type e.g. in this case a multi-select list of possible allergens.
Please note that multi-select fields will be an 'OR' match - we coding the test this way since otherwise it would only match articles with the exact same combination of select list items selected.
So if you wanted we wanted to hide recipes which have Wheat or Crustaceans in their allergen list we could setup our menu item as follows
BUT If we wanted to hide recipes which have BOTH Wheat AND Crustaceans in their allergen list we should setup our menu item as follows: