-
-
Save hirejordansmith/3bb0023325842daad4e8 to your computer and use it in GitHub Desktop.
Useful WooCommerce Snippets
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_single_product_summary', 'hjs_add_brand_by_link', 5); | |
function hjs_add_brand_by_link() { | |
global $post; | |
$post_id = $post->ID; | |
$terms = get_the_terms($post_id, 'product_brand' ); | |
foreach ($terms as $term) { ?> | |
<span class="brand-by-link">by <a href="<?php echo get_term_link( $term, 'product_brand' ); ?>"><?php echo $term->name; ?></a></span> | |
<?php } | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment