Add infos to the product loop
-
Hello,
I’m trying to add the terms of 2 custom taxonomies to the product loop, just under the title and above the price so I added this code to function.php of my child theme.
function product_loop_meta() { $terms_artist = get_the_terms( $post->ID , 'artist' ); foreach ( $terms_artist as $term_artist ) { $term_link_artist = get_term_link( $term_artist, 'artist' ); if( is_wp_error( $term_link_artist ) ) continue; } $terms_label = get_the_terms( $post->ID , 'label' ); foreach ( $terms_label as $term_label ) { $term_link_label = get_term_link( $term_label, 'label' ); if( is_wp_error( $term_link_label ) ) continue; } echo '<div class="product-loop-meta"> <a href="' . $term_link_artist . '">' . $term_artist->name. ' </a><br> <a href="' . $term_link_label . '">' . $term_label->name. ' </a> </div>'; } add_action('woocommerce_shop_loop_item_title','product_loop_meta',15);
But it’s not working. Any idea to fix that?
ThanksThe page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Add infos to the product loop’ is closed to new replies.