wordpress 更改 WooCommerce 产品页面布局

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22894981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:31:15  来源:igfitidea点击:

Change WooCommerce Product-Page Layout

wordpresswordpress-pluginwoocommerce

提问by Hamed mayahian

I'm Trying Customize WooCommerceProduct-page Design.

我正在尝试自定义WooCommerce产品页面设计。

I using woocommerce.phppage and use <?php woocommerce_content(); ?>for provide content on there.

我使用woocommerce.php页面并<?php woocommerce_content(); ?>用于在那里提供内容。

So i want Customize Layout of <?php woocommerce_content(); ?>base of my design. How to Change or Customize That?

所以我想自定义<?php woocommerce_content(); ?>我的设计基础的布局。如何更改或自定义?

How To Access To <?php woocommerce_content(); ?>layout?

如何访问<?php woocommerce_content(); ?>布局?

Thanks

谢谢

回答by Howli

The page design can be edited in the wc-template-functions.phppage. It can be found in the woocommerce/includesfolder.

页面设计可以在wc-template-functions.php页面中编辑。它可以在woocommerce/includes文件夹中找到。

回答by Nohl

The Woocommerce team strongly suggest you modify your theme with add on files rather than edit the plugin. This process makes your work much more 'upgrade proof'

Woocommerce 团队强烈建议您通过添加文件而不是编辑插件来修改主题。这个过程使您的工作更加“升级证明”

Click here for link to Woo docs website and article...

单击此处链接到 Woo docs 网站和文章...

The template files of WooCommerce contain the markup and template structure for the front-end (and HTML emails) of your store. If you open these files you'll notice they all contain many hooks which will allow you to add / move content without having to edit the template files themselves. This method protects even further against any upgrade issues as the template files can be left completely untouched.

Alternatively, you can edit these files in an upgrade safe way through overrides. Simply copy it into a directory within your theme named /woocommerce, keeping the same file structure.

Example: To overide the admin order notification, copy: woocommerce/templates/emails/admin-new-order.php to yourtheme/woocommerce/emails/admin-new-order.php The copied file will now override the WooCommerce default template file. Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customisations will be lost.

WooCommerce 的模板文件包含商店前端(和 HTML 电子邮件)的标记和模板结构。如果您打开这些文件,您会注意到它们都包含许多钩子,这些钩子允许您添加/移动内容而无需编辑模板文件本身。这种方法可以进一步防止任何升级问题,因为模板文件可以完全保持不变。

或者,您可以通过覆盖以升级安全的方式编辑这些文件。只需将其复制到您的主题中名为 /woocommerce 的目录中,并保持相同的文件结构。

示例:要覆盖管理订单通知,请将:woocommerce/templates/emails/admin-new-order.php 复制到 yourtheme/woocommerce/emails/admin-new-order.php 复制的文件现在将覆盖 WooCommerce 默认模板文件。不要在核心插件本身内编辑这些文件,因为它们在升级过程中被覆盖,任何自定义都将丢失。