ขนาดวิดีโอ: 1280 X 720853 X 480640 X 360
แสดงแผงควบคุมโปรแกรมเล่น
เล่นอัตโนมัติ
เล่นใหม่
What would I change the code to look like if I wanted to add a custom badge to just a single category?
Awesome tutorial, thank you for making this. quick question: currently my products price is at the top (Above the title and categories) Any idea how to place it below the product name :)
How do you get it to come up in a catagory page in woo?
The code - function by_woo_additions() { global $post; $terms = get_the_terms( $post->ID, 'product_cat' ); $terms_tag = get_the_terms( $post->ID, 'product_tag' ); if ( $terms ) { foreach( $terms as $term ){ $cat_name[] = $term->name; } $the_categories = implode(' | ', $cat_name ); echo '' . $the_categories . ''; } $sale_price = get_post_meta( $post->ID, '_sale_price', true); if ( $sale_price> 0 ) { echo 'SALE'; }}add_action( 'woocommerce_shop_loop_item_title', 'by_woo_additions', 1 );function by_woo_additions_a() { global $post; $terms = get_the_terms( $post->ID, 'product_cat' ); $terms_tag = get_the_terms( $post->ID, 'product_tag' ); if ( $terms ) { foreach( $terms as $term ){ if ( $term->name == 'Beanie' || $term->name == 'Hoodies' ) { echo 'Head Warmer'; } } }}add_action( 'woocommerce_after_shop_loop_item_title', 'by_woo_additions_a', 5 );
What would I change the code to look like if I wanted to add a custom badge to just a single category?
Awesome tutorial, thank you for making this. quick question: currently my products price is at the top (Above the title and categories) Any idea how to place it below the product name :)
How do you get it to come up in a catagory page in woo?
The code - function by_woo_additions() {
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
$terms_tag = get_the_terms( $post->ID, 'product_tag' );
if ( $terms ) {
foreach( $terms as $term ){
$cat_name[] = $term->name;
}
$the_categories = implode(' | ', $cat_name );
echo '' . $the_categories . '';
}
$sale_price = get_post_meta( $post->ID, '_sale_price', true);
if ( $sale_price> 0 ) {
echo 'SALE';
}
}
add_action( 'woocommerce_shop_loop_item_title', 'by_woo_additions', 1 );
function by_woo_additions_a() {
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
$terms_tag = get_the_terms( $post->ID, 'product_tag' );
if ( $terms ) {
foreach( $terms as $term ){
if ( $term->name == 'Beanie' || $term->name == 'Hoodies' ) {
echo 'Head Warmer';
}
}
}
}
add_action( 'woocommerce_after_shop_loop_item_title', 'by_woo_additions_a', 5 );