Is there a way to turn this method around, so I get a collection of all the images in a folder, except the one that contains the string “cover” in its name? I know you can define your own filter methods, but how exactly would I go about that? I’d be grateful for any hints.
where !*= means “doesn’t contain”. To install this filter create a file filterStringContainsNot.php (or whatever you like) at plugins/ and save this code:
This is great. It allows me to build a collection of members that have “Officer” in the position field, but can this be tweaked to allow me to filter multiple position values. For example what if I wanted to get a collection of members that have either “Officer” or “Executive Board” as a value in the position field?
I am trying to achieve the same result, i.e show all images except for images with the word ‘cover’ in the name. For some reason this code is still showing me all the images, including those with ‘cover’ in the file name.
@elaltito Do you want to exclude all files that contain the string cover or only the one with the filename cover. For the first option, use the code provided by @bastianallgeier
Thanks for your help @texnixe ! I have just finished upgrading to Kirby 3, what would be the shorter way to achieve this then? And yes I would like to exclude all files that include the string ‘cover’, for example “photo_cover.jpg”