Trouble displaying attribute values
-
I’m using Woocommerce for product display on a website I’m working on. When I’m fetching my custom attribute values I get what seems to be random empty strings between the values. Watch an example here:
http://tec.macework.se/produkt/premium-short-sleeve-jersey-white/
Here’s my code for fetching the values:
<?php $atts = get_the_terms( $product->id, 'pa_attribute-1'); foreach ( $atts as $att ) { ?> <li> <?php echo $att->name; ?> </li> <?php } wp_reset_query(); ?> <?php $atts = get_the_terms( $product->id, 'pa_attribute-2'); foreach ( $atts as $att ) { ?> <li> <?php echo $att->name; ?> </li> <?php } wp_reset_query(); ?> <?php $atts = get_the_terms( $product->id, 'pa_attribute-3'); foreach ( $atts as $att ) { ?> <li> <?php echo $att->name; ?> </li> <?php } wp_reset_query(); ?> <?php $atts = get_the_terms( $product->id, 'pa_attribute-4'); foreach ( $atts as $att ) { ?> <li> <?php echo $att->name; ?> </li> <?php } wp_reset_query(); ?>What’s up with the empty strings?
The topic ‘Trouble displaying attribute values’ is closed to new replies.