如何在 WP 电子商务插件中获取相对于产品 ID 的类别名称
我正在使用 WP eCommerce 在我的网站中显示产品。我想检查页面中显示的每个产品的类别名称。
while (wpsc_have_products()) : wpsc_the_product();
$product_id=wpsc_the_product_id();
//here I want to get the category name with respect to $product_id in which this product exists.
my code continues...
endwhile;
是否可以?
请帮我
I am using WP eCommerce for displaying products in my website.I want to check the category name of each product displaying in the page.
while (wpsc_have_products()) : wpsc_the_product();
$product_id=wpsc_the_product_id();
//here I want to get the category name with respect to $product_id in which this product exists.
my code continues...
endwhile;
Is it possible?
Please help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我研究了 bredcrumbs 类,这帮助我找到了一个与我遇到的非常相似的问题的解决方案。不管怎样,粘贴这段代码,它就会为你打印出类别名称。
希望这有帮助。我将对此进行更多探索,并将结果发布在我的博客上,http://www.consofas.com/罗汉
。
I looked into the bredcrumbs class and that helped me find a solution to a very similar problem that I had. Anyway, paste this code in and it will print out the category name for you.
Hope this helps. I will be exploring this a bit more and will put up my results on my blog, http://www.consofas.com/
Rohan.
我记得,它们存储为帖子,因此您可以使用普通的类别 api。
get_the_category()
,我突然想到,应该会产生术语列表。Best I recollect, they're stored as posts, so you can use the normal category api.
get_the_category()
, off the top of my head, should yield the list of terms.