Last active
June 17, 2019 12:30
-
-
Save cubehrends/96693c9f50c12842f8132e019a60f85b to your computer and use it in GitHub Desktop.
Addin Brand Name to Item Title in WooCommerce Product Lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('woocommerce_shop_loop_item_title','brands_to_item_title', 11); | |
function brands_to_item_title( ) { | |
$brands = wp_get_post_terms( get_the_ID(), 'product_brand' ); | |
if ( count( $brands ) > 0 ) { | |
foreach( $brands as $brand ) | |
echo '<span class="brand-name">' . $brand->name . '</span>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment