Woocommere product thumbnail
Posted by:
AskinSavascisi
Oct 29, 2017 at 09:19 (7 year ago)
Hi,
I've added some woocommerce products however some of them hasn't a product image yet so i wanted to change the product placeholder and added a little snippet.
// Default product afbeelding veranderd
add_action( 'init', 'custom_fix_thumbnail' );
function custom_fix_thumbnail() {
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
$src = $uploads . '/2017/10/placeholder.jpg';
return $src;
}
}
with this code i changed the placeholder succesfully however on your theme at shop page it isn't working but it works on single item page. i'm adding screenshots for better understanding. It does work on stock wordpress theme (twenty seventeen).
I've added some woocommerce products however some of them hasn't a product image yet so i wanted to change the product placeholder and added a little snippet.
// Default product afbeelding veranderd
add_action( 'init', 'custom_fix_thumbnail' );
function custom_fix_thumbnail() {
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
$src = $uploads . '/2017/10/placeholder.jpg';
return $src;
}
}
with this code i changed the placeholder succesfully however on your theme at shop page it isn't working but it works on single item page. i'm adding screenshots for better understanding. It does work on stock wordpress theme (twenty seventeen).