Created
January 30, 2019 08:37
-
-
Save ibndawood/105fbb4797bc1e10395bf1bd105e0f0c to your computer and use it in GitHub Desktop.
Electro v2 - Show brand name in product loop
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
add_action( 'woocommerce_shop_loop_item_title', 'ec_template_loop_product_brand', 41 ); | |
function ec_template_loop_product_brand() { | |
global $product; | |
$product_id = electro_wc_get_product_id( $product ); | |
$brands_tax = electro_get_brands_taxonomy(); | |
$terms = get_the_terms( $product_id, $brands_tax ); | |
$brand_name = ''; | |
if ( $terms && ! is_wp_error( $terms ) ) { | |
foreach ( $terms as $term ) { | |
$brand_name .= $term->name ; | |
} | |
} | |
if ( ! empty( $brand_name ) ) : ?> | |
<div class="brand"> | |
<?php echo wp_kses_post( $brand_name ); ?> | |
</div> | |
<?php endif; | |
} |
Thanks for your help, I've just emailed the support.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please email Electro support from here: https://themeforest.net/item/electro-electronics-store-woocommerce-theme/15720624/support