I am trying to create a template for my custom post type (products) custom taxonomy (product_category) that will show sub categories if there are any and but if there aren’t, then it should list the products.
As an example
categories:
category1
category2
-sub-category1
-sub-catetory2
category3
so if the url is loaded (/product_category/category1) then it will list the products in that category.
However if (/product_category/category2) is loaded, then it will show the names “subcategory1” and “subcategory2” but no actual products.
Here is what I came up with so far, but it feels “hacky” is there a better way to do this?
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com