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 WooCommerce và thê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
Thay tien_nghi bằng tên custom fields của bạn
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' ); echo '<p>' . get_field('sophongtam') . '</p>'; }
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
I think every concept you put up in your post is strong and will undoubtedly be implemented. Still, the posts are too brief for inexperienced readers. Would you kindly extend them a little bit from now on? I appreciate the post.
Somebody essentially lend a hand to make significantly posts I might state That is the very first time I frequented your web page and up to now I surprised with the research you made to create this particular put up amazing Excellent job
I liked it as much as you did. Even though the picture and writing are good, you’re looking forward to what comes next. If you defend this walk, it will be pretty much the same every time.