in woocommerce 2.4, edited /loop/title.php include product attribute, this:
<h3 itemprop="name" class="product_title entry-title"><?php $versionvalues get_the_terms( $product->id, 'pa_artist'); foreach ( $versionvalues $versionvalue ) { echo $versionvalue->name; } ?></h3>
in woocommerce 2.5, title.php no longer used. built function. having real difficulty returning product attribute editing functions.php in child theme.
i have been trying use code, foreach
throws error.
if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) { /** * show product title in product loop. default h3. */ function woocommerce_template_loop_product_title() { echo '<h3>' . get_the_title() . '</h3>'; echo '<h3 itemprop="name" class="product_title entry-title">' . $versionvalues get_the_terms( $product->id, 'pa_artist'); echo foreach ( $versionvalues $versionvalue ) { echo $versionvalue->name; echo } '</h3>'; } }
anyone point me in right direction?
your code messed up.. try this... not edit plugin... add code functions.php
in theme...
function my_template_loop_product_title(){ global $product; echo '<h3 itemprop="name" class="product_title entry-title">'; $versionvalues = get_the_terms( $product->id, 'pa_artist'); foreach ( $versionvalues $versionvalue ) { echo $versionvalue->name; } echo '</h3>'; } add_action( 'woocommerce_shop_loop_item_title', 'my_template_loop_product_title', 10 );
Comments
Post a Comment