You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the widget logic plugin to display different text widgets in different product categories - so far so good, this works excellent, by simply adding the product category conditional tag --> is_product_category('xyz') into the widget logic field below the according widget.
However, I was not able to make this possible for a specific product in woocommerce. Using this conditional tag: is_product () will solely then show the widget in ALL product pages.
Is there any way to target a specific product, using the unique product ID?
This is what I currently have for regular php:
function check_specific_page() {
global $product;
if( $product->id == 1 && is_product() )
die( 'I\'m showing only on single product page with id 1' );
}
Adding $product->id == 1 && is_product() into the widget logic field however does not work.
I really hope you can help...basically what I need is the conditional tag for a specific product.
Thanks so much,
Rich
The text was updated successfully, but these errors were encountered:
Works like charm... is_single(ID) ... just like @richangel, i have dived into different articles for hours and i am glad i opened this link. Thanks so much @mikejolley
Hi everyone,
I am using the widget logic plugin to display different text widgets in different product categories - so far so good, this works excellent, by simply adding the product category conditional tag --> is_product_category('xyz') into the widget logic field below the according widget.
However, I was not able to make this possible for a specific product in woocommerce. Using this conditional tag: is_product () will solely then show the widget in ALL product pages.
Is there any way to target a specific product, using the unique product ID?
This is what I currently have for regular php:
function check_specific_page() {
global $product;
}
Adding $product->id == 1 && is_product() into the widget logic field however does not work.
I really hope you can help...basically what I need is the conditional tag for a specific product.
Thanks so much,
Rich
The text was updated successfully, but these errors were encountered: