Cách thêm Advanced custom fields dưới tiêu đề Product Woocommerce

Help.Anbiweb.com 

Hướng dẫn Cách thêm Advanced custom fields dưới tiêu đề Product Woocommerce, add advanced custom fields below tittle product woocommerce, Show ACF field in WooCommerce Archive Listing, Add custom field in WooCommerce single product page

Chèn đoạn code sau vào file funstions.php , đoạn code dưới sẽ xóa tiêu đề mặc định của WooCommercethêm tiêu đề mới, custom fields dưới phần giá.

function sly_switch_loop_title(){  remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );  add_action( 'woocommerce_after_shop_loop_item_title', 'sly_template_loop_product_title', 15 );  }  add_action( 'woocommerce_before_shop_loop_item', 'sly_switch_loop_title' );    function sly_template_loop_product_title() {  echo '<h2 class="woocommerce-loop-product__title">' . get_the_title() . '</h2>';  echo the_field( 'tien_nghi' );  }

đoạn code đơn giản hơn, ko xóa tiêu đề mà chỉ thêm custom fields

function sly_switch_loop_title(){  add_action( 'woocommerce_after_shop_loop_item_title', 'sly_template_loop_product_title', 15 );  }  add_action( 'woocommerce_before_shop_loop_item', 'sly_switch_loop_title' );  function sly_template_loop_product_title() {  echo the_field( 'tien_nghi' );  }
Nguồn bài viết: https://help.anbiweb.com/cach-them-advanced-custom-fields-duoi-tieu-de-product-woocommerce/ Diễn đàn thiết kế website chuyên nghiệp | Digital Marketing | Quảng cáo Facebook | Quảng cáo Google Phát triển bởi: Công ty Công Nghệ & Truyền Thông Thabidu Việt Nam Vận hành bởi: Công ty thiết kế anbiweb Hệ thống kinh doanh: Anbiweb.com - Thabidu.comTramymedia.com

Đăng nhận xét

0 Nhận xét