Skip to content

Instantly share code, notes, and snippets.

@cubehrends
Last active June 17, 2019 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cubehrends/96693c9f50c12842f8132e019a60f85b to your computer and use it in GitHub Desktop.
Save cubehrends/96693c9f50c12842f8132e019a60f85b to your computer and use it in GitHub Desktop.
Addin Brand Name to Item Title in WooCommerce Product Lists
<?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