-1

I want to display product attributes of 2 different product category with the help of conditional tags. But the condition was not working

This is the condition that i given 
Height:get('height'); ?> Width:get('width'); ?> Thickness:get('thickness'); ?> Frame Size:get('frame_size'); ?> Weight after packing:get('weight_after_packing'); ?> Large:get('large'); ?> Medium:get('medium'); ?> Small:get('small'); ?>
If the condition is working with the help of action hook. But i am not aware abt that .Can u pls help me... 
  • What exactly do you want to do? Are you wanting to hook in something to a single product page or product category archive? – Brad Dalton Dec 31 '13 at 9:59
  • I want hook to a single product page – Rose Jan 1 '14 at 6:03
  • is_product() for all single product pages or is_product('slug') for specific product page – Brad Dalton Jan 1 '14 at 10:23
  • <?php if ( is_product('t-shirt') ) {?> <table style="font-size:18px; line-height:25px; color:#513102; width:400px; height:200px;"> <tr><td>Height:-</td><td><?php echo $cfs->get('height'); ?></td></tr> <tr><td>Width:-</td><td><?php echo $cfs->get('width'); ?></td></tr> </table> <?php } else {?> <table style="margin-top:20px; width:200px; height:100px; font-size:14px;" id="tt"> <tr><td>Large:-</td><td><?php echo $cfs->get('large'); ?></td></tr> <tr><td>Medium:-</td><td><?php echo $cfs->get('medium'); ?></td></tr> </table> <?php }?> – Rose Jan 3 '14 at 9:20
  • hi dis is my code but d condition is not working – Rose Jan 3 '14 at 9:21
1

Firstly, this conditional returns true on category archives for Woo Commerce and NOT single product page.

Try using the actual slug in lowercase or the i.d.

Example:

  if ( is_product_category( 't-shirt' ) ) {

Your code looks like its wrong because it includes too many brackets.

Woo suggest using the slug in their Docs.

This is the correct conditional which returns true on a single product page.

is_product()

Here's all the Woo hooks & conditional tags you can use in custom functions from your child themes functions file.

http://docs.woothemes.com/document/hooks/

http://docs.woothemes.com/document/conditional-tags/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.