Is there any way to use the search API to search through image caption files (*.jpg.txt) and returning an array with images whose caption contains the query, alternative return the caption file it self.
See this solution:
A filter with a callback function would work here as well.
Ok, that makes sense. Only thing that is strange now is that my $pages->files() is an empty collection…
Do your first level pages contain any images at all?
$pages->files() will grab all images from all first level pages, i.e. the folders directly in content, not from any children of these pages. Use
page('blog')->children()->files() to get a collection of all files of all subfolders of the blog page, for example.
awesome, the custom search works and I am now targeting the page correctly (page(‘page-type’)) to search through it’s custom image captions, works like charm.