自定义主题单产品页WordPress/WooCommerce
我正在构建我的自定义主题,而我的sings.php显示WooCommerce单产品页面,
if ( have_posts() ) {
while( have_posts() ) {
the_post();
the_content();
}
}
为什么页面缺少 - 标题,评论&面包屑?
I am building my custom theme and my single.php displays woocommerce single product page with
if ( have_posts() ) {
while( have_posts() ) {
the_post();
the_content();
}
}
Why is the page missing - title, reviews & breadcrumbs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
WooCommerce有自己的页面模板。单个产品应显示在单产品。php上。您将在自定义主题中创建一个WooCommerce文件夹,并将要编辑的目录和文件复制到主题。
如何覆盖单ploduct.php
如果您想克服单ploduct.php,则会在主题中创建一个WooCommerce文件夹,并将单product.php复制到其中。因此,目录将为
yourtheme/woocommerce/smine-product.php
。这样,您就会在缺少的功能中挂起所有操作。这是文档:
Woocommerce has its own templates for their pages. A single product should be showing on single-product.php. You would create a woocommerce folder inside your custom theme and copy the directories and files you want to edit over to your theme.
How to override single-product.php
If you want to custimize the single-product.php, you would create a woocommerce folder in your theme and copy the single-product.php over into it. So the directory would be
yourtheme/woocommerce/templates/single-product.php
. This way you have all the actions hooking in the functionality you are missing.Here are the docs:
https://woocommerce.com/document/template-structure/
请在functions.php文件中添加这个
Please add this one in the functions.php file
缺少
我的functions.php文件中
I was missing
in my functions.php file