Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › No pictures from Envira gallery when matching caption text
This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years, 4 months ago.
- AuthorPosts
- February 7, 2021 at 10:37 pm #31489
I am searching Envira galleries and I am getting results from matching terms in picture captions – this is what I want. But the picture is not being displayed? How can I make it display? I have tried all the different options under General Options/Image Options.
I have attached a sample result with no photos showing on the Envira results.
Thank you.
David Cook
February 7, 2021 at 10:44 pm #31490Here is a sample search result
Attachments:
You must be logged in to view attached files.February 8, 2021 at 10:35 am #31497Hi,
Thank you for the deteils. The reason it didn’t work, because there is no featured image, nor any content within those gallery posts whatsoever, so the plugin was not able to get any images from that.
Luckily I found some information on their documentation API, and added the following code to your theme functions.php file to parse the images during a post process:
add_filter( 'asp_results', 'asp_envira_images', 10, 1 ); function asp_envira_images( $results ) { foreach ($results as $k=>&$r) { if ( isset($r->post_type) && $r->post_type == 'envira' ) { $r->image = asp_get_image_from_content( do_shortcode('[envira-gallery id="'.$r->id.'"]') ); } } return $results; }
Please keep that code in there.
Also note, that we cannot guarantee that this solution works a 100% of the time, as it qualifies as a custom coding request. Personally I think it should be perfectly fine though.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.