Sử dụng WC_Widget_Product_Categories trong theme như nào? (ok)
✅ Cách sử dụng WC_Widget_Product_Categories trong theme:
WC_Widget_Product_Categories trong theme:phpCopyEdit<?php
the_widget(
'WC_Widget_Product_Categories', // Tên class của widget
array(
'title' => 'Danh mục sản phẩm', // Tiêu đề widget
'orderby' => 'name', // Sắp xếp theo tên
'dropdown' => false, // Hiển thị dạng dropdown (true/false)
'count' => true, // Hiển thị số lượng sản phẩm trong danh mục
'hierarchical' => true, // Hiển thị phân cấp danh mục
),
array(
'before_widget' => '<div class="widget widget_product_categories">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
?>🧠 Giải thích các tham số:
📦 Gợi ý vị trí đặt mã:
🛠 Mẹo:
PreviousChange field Description in slides Elementor to Text rich (ok)NextPlugin bảo mật ẩn tất cả các thông tin khác (ok)
Last updated