Showing Attachments as a separate section in search results
-
I have posts that have image galleries. Each image has alt, title and caption text. I turned on searching through attachments and the excerpt shows any string found in the main post as well as any images that have the search term in it’s meta data. Works great.
I’d like to change the display though that instead of one long excerpts with the image caption in it, I want the excerpts of the post separated from the found images:
...this is the excerpt text that was found... Photos in this post: A photo with an excerpt, an excerpt photo...
I looked at the ‘relevanssi_excerpt_content’ filter, The $content it seems returns the images found + the current post.
I could try to look for an occurrence of <a…> to determine when there are images in it and then replace with ‘Photos in this post:’ but that seems error prone.
It also won’t let me put space between the excerpt and the photos list.What’s the right way to this? Or is this not possible with Relevanssi?
- The topic ‘Showing Attachments as a separate section in search results’ is closed to new replies.