Tagged: placeholder image, product image, woocommerce
Hey,
I tried these:
http://stackoverflow.com/questions/27844825/how-does-one-replace-woocommerce-default-placeholder-image-for-shop-categories#answers-header
https://docs.woothemes.com/document/change-the-placeholder-image/
But dont work… :( Do you have any idea?
Kind regards,
Peter
Hm, I see the placholder image on the backend and I see the placeholder image on the singel product page… but I dont see the placeholder image on the shop / catalog page.
Thank you
Hi,
Thank you for using Enfold.
The theme is not using the default product thumbnail template. Add this in the functions.php file to add a placeholder:
add_action( 'after_setup_theme', 'after_setup_theme_mod' );
function after_setup_theme_mod(){
remove_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail', 10);
add_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail_mod', 10);
}
function avia_woocommerce_thumbnail_mod($asdf)
{
global $product, $avia_config;
$rating = $product->get_rating_html(); //get rating
$id = get_the_ID();
$size = 'shop_catalog';
echo "<div class='thumbnail_container'>";
echo avia_woocommerce_gallery_first_thumbnail( $id , $size);
$thumbnail = get_the_post_thumbnail( $id , $size );
if(!empty($thumbnail)) {
echo $thumbnail;
}
else {
echo "<img src='PLACEHOLDER IMAGE HERE'/>";
}
if(!empty($rating)) echo "<span class='rating_container'>".$rating."</span>";
if($product->product_type == 'simple') echo "<span class='cart-loading'></span>";
echo "</div>
";
}
Adjust the src attribute “PLACEHOLDER IMAGE HERE”.
Best regards,
Ismael
Amazing it’s work! :) Thank you!