No pictures from Envira gallery when matching caption text

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 Ernest Marcinko 1 year, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31489
    technowconsult82
    technowconsult82
    Participant

    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

    #31490
    technowconsult82
    technowconsult82
    Participant

    Here is a sample search result

    Attachments:
    You must be logged in to view attached files.
    #31497
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 :)


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.