Skip to content

Instantly share code, notes, and snippets.

@anastransvelo
Forked from farookibrahim/functions.php
Last active May 24, 2019 08:19
Show Gist options
  • Save anastransvelo/86be36b27ecb82c356b5c25d4aba0cdf to your computer and use it in GitHub Desktop.
Save anastransvelo/86be36b27ecb82c356b5c25d4aba0cdf to your computer and use it in GitHub Desktop.
Electro display tags in archive
if ( ! function_exists( 'electro_template_loop_tags' ) ) {
/**
* Output Product Tags
*
*/
function electro_template_loop_tags() {
global $product;
$product_id = electro_wc_get_product_id( $product );
$tags = wc_get_product_tag_list( $product_id );
echo apply_filters( 'electro_template_loop_tags_html', wp_kses_post( sprintf( '<span class="loop-product-tags">%s</span>', $tags ) ) );
}
}
add_action( 'woocommerce_before_shop_loop_item_title', 'electro_template_loop_tags', 20 );
.products>.product .loop-product-tags {
margin-bottom: .4em;
font-size: .8em;
line-height: 1.05em;
height: 1.1em;
}
i.product .loop-product-tags a {
color: #878787;
}
@media (min-width: 1200px) {
.products>.product .loop-product-tags {
margin-bottom: 6px;
font-size: .857em;
line-height: 1.05em;
height: 1.05em;
display: block;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment