I'm using this function below to controll which kind of thumbnail is used at the frontend from my shop
The problem happens when I try to include this part:
else {
echo woocommerce_get_product_thumbnail();
}
after each other of the "if's" that are on the function. I have already tried using elseif, but also returns an error.
How can I accomplish it ? Is there any mispelled sign?
function woocommerce_template_loop_product_thumbnail() {
if ( is_tax( 'product_cat', 'linha-floresta' ) ) {
echo woocommerce_get_product_thumbnail( 'woocommerce_catalog' );
} else {
echo woocommerce_get_product_thumbnail();
} if ( is_tax( 'product_cat', 'linha-aroma' ) ) {
echo woocommerce_get_product_thumbnail( 'woocommerce_catalog' );
} if ( is_tax( 'product_cat', 'linha-revelacao' ) ) {
echo woocommerce_get_product_thumbnail( 'woocommerce_catalog' );
} }
You else needs to be last in the if-elseif-else statements:
function woocommerce_template_loop_product_thumbnail() {
if ( is_tax( 'product_cat', 'linha-floresta' ) ) {
echo woocommerce_get_product_thumbnail( 'woocommerce_catalog' );
}
elseif ( is_tax( 'product_cat', 'linha-aroma' ) ) {
echo woocommerce_get_product_thumbnail( 'woocommerce_catalog' );
}
elseif ( is_tax( 'product_cat', 'linha-revelacao' ) ) {
echo woocommerce_get_product_thumbnail( 'woocommerce_catalog' );
}
else {
echo woocommerce_get_product_thumbnail();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.