Reply To: Image in default search page


Ernest Marcinko


I am assuming you want to display the images from across a different multisite blog?

The plugin passes on the post objects to the results page, there is no other variable set there with the results. The image URLs are not stored within the Post object in wordpress, so this can be very difficult to get.
You will need some sort of custom code in the results loop in the template. I would try something like:
– Switch temporarily to the other site using: switch_to_blog
– Then get the post featured image by id using:

wp_get_attachment_url( get_post_thumbnail_id($post->ID) );

– Then switch back to the current site: restore_current_blog

This is just the outline, it can be much more difficult than that, I am not sure if this is even possible.

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)