Created
January 30, 2017 22:11
-
-
Save WPprodigy/d01f997822cf4931ec116b3d67ac2aaa to your computer and use it in GitHub Desktop.
Add brands listing underneath products on archive pages: http://cld.wthms.co/6ud1/586aeCgL
This file contains hidden or 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
add_action( 'woocommerce_after_shop_loop_item', 'wc_ninja_add_brands_to_archives', 6 ); | |
function wc_ninja_add_brands_to_archives() { | |
global $post; | |
$brand_count = sizeof( get_the_terms( $post->ID, 'product_brand' ) ); | |
$taxonomy = get_taxonomy( 'product_brand' ); | |
$labels = $taxonomy->labels; | |
echo get_brands( $post->ID, ', ', ' <div class="posted_in">' . sprintf( _n( '%1$s: ', '%2$s: ', $brand_count ), $labels->singular_name, $labels->name ), '</div>' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good!!!!!!