How do I fix my theme so it displays product thumbnails using External Images plugin?

Our External Images plugin hooks into the correct WordPress and WooCommerce functions to generate a thumbnail.

The way WordPress works is that these functions are created so plugin developers can add ‘hooks’ and ‘filters’ to those functions to alter functionality or display output.

If you have installed our External Images plugin and you are finding your product archive is not displaying the images, it almost certainly means your theme is accessing the thumbnail information directly. This is not how themes are supposed to access thumbnail information and is deprecated behaviour, meaning your theme may not work in future versions of WordPress.

What to look for in your theme?

If you download your theme files, it makes it easier to search through them using programs like Agent Ransack (a file contents searching utility). So, download your theme files and search for the following:

echo $post->thumbnail

Or possibly something like this:

$post_thumbnail_id = get_post_thumbnail_id( $post );
echo unero_get_image_html( $post_thumbnail_id, $image_size );

If you see that code in your theme, this is why your theme is not displaying external images. Here’s an example from the “Total Theme” by https://wpexplorer-themes.com/total/:

How to fix your theme so it’s compatible with the External Images plugin and other thumbnail plugins

To fix your theme, it depends if this code is inside a WooCommerce archive loop, or inside a normal WordPress archive loop.

Firstly, you should create a child theme if you haven’t already, and you should then copy the relevant files from your parent theme to the same folder structure in your child theme.

Then, within the file containing the offending code, alter the statements that are accessing the thumbnail HTML directly instead of using the correct functions.

If it’s a WooCommerce archive loop, replace echo $post->thumbnail; with:

woocommerce_template_loop_product_thumbnail();

If it’s a normal WordPress loop, replace echo $post->thumbnail; with:

the_post_thumbnail();

Note: There’s no need for an echo statement, since there is an echo statement inside these function calls.

Once you have edited your child theme files, upload them to your server and refresh your archive pages and the External Images plugin will now work correctly.

Summary

Some themes access thumbnail HTML directly, when the correct way to access thumbnail HTML is through the provided Woo and WordPress functions. You can fix your theme by replacing these echo statements with the relevant correct function calls listed above.