最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

categories - Best way of getting WooCommerce category path

programmeradmin1浏览0评论

If I am on a product or any category/subcategory I want to display a complete path to the topmost category. Does WooCommerce already have a function for it or do I need to make my own loop that goes from child to parent? Should I use $wp_query->get_queried_object()? What is the best code for it?

Example:

If I am on a product or any category/subcategory I want to display a complete path to the topmost category. Does WooCommerce already have a function for it or do I need to make my own loop that goes from child to parent? Should I use $wp_query->get_queried_object()? What is the best code for it?

Example:

Share Improve this question asked Feb 9, 2020 at 6:00 Hrvoje BatrnekHrvoje Batrnek 1134 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I think you may look for breadcrumb? Can you try it?

<?php woocommerce_breadcrumb(); ?>

This link may help: https://docs.woocommerce/document/woocommerce_breadcrumb/

发布评论

评论列表(0)

  1. 暂无评论