Hi Alejo! First of all, thanks for trying our plugin. WordPress offers different mechanisms to print a featured image. The two most important ones are [get_]the_post_thumbnail() and wp_get_attachment_image_src(). However, only the first one (which returns HTML code) offers a filter in which we can hook and, thus, change the featured image “on the fly”.
I took a look at the plugin you mention and its source code. The plugin uses the second function I mentioned (wp_get_attachment_image_src()). However, if you take a look at file class-daves-wordpress-live-search-results.php line 91, you’ll see the plugin defines a filter called dwls_attachment_thumbnail. I think that you can hook there and change the featured image it shows.
In order to do so, simply go to your theme’s functions.php file and define the following hook:
add_filter( "dwls_attachment_thumbnail", "use_nelio_ext_fi", 10, 1 );
function use_nelio_ext_fi( $old_featured_image ) {
global $post;
$image_url = get_post_meta( $post->ID, '_nelioefi_url', true );
if ( $image_url && strlen( $image_url ) > 0 )
return $image_url;
else
return $old_featured_image;
}
The previous function looks whether the current post has an external featured image. If it does, it is returned. Otherwise, the featured image the plugin would have set up is returned.
Regarding width and height scaling: yes, there are some functions in PHP. Nonetheless, I recommend you stick to CSS scaling.
Ohhh ….. Thank you, IT WORKS!!
Thank you very much not only for the solution, but for your time and dedication to provide the solution, for teaching and for this great plugin.
Regards from Argentina.
I am glad to hear, Alejo. Enjoy the plugin and don’t forget to 5-star the plugin!
¡Saludos desde Barcelona!