Reputation: 11
I have woo commerce site, but in few specific product pages i don't want to show products images. How can i hide product image in specific pages only? once hide/remove product image, need to speared the text/content.
Upvotes: 1
Views: 374
Reputation: 253814
This can be done with this simple code:
add_action( 'template_redirect', 'single_product_remove_images', 1 );
function single_product_remove_images() {
// HERE below set your Page ID, title or slug
if( is_page( 56 ) ){
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
}
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If you want to target a post id istead, you will use something like
if( get_the_id() == 56 ){
Upvotes: 2