我最难修改storefont模板的wooccommerce布局。我的目录是:
-
woocommerce插件的位置:
wp-content/plugins/woocommerce/templates
-
我将上面模板文件夹中的所有内容复制到:
wp-content/themes/storefront_child/woocommerce/
-
修改上面wooccommerce文件夹中的任何文件,例如写入OMG页面上的任何位置。
- 我的页面上没有显示任何内容
我是WordPress的新手,我不知道如何修改插件/模板的文件。我也没有激活我的子模板(这是必需的吗?)。当我复制wooccommerce文件并尝试安装它们时,它说模板丢失了。
打开functions.php
然后在那里复制以下代码:
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
然后检查结果
经过大量研究,我终于得到了它。大多数网站都忽略了真正"激活"子主题的是CSS中的注释。因此,子主题必须包含CSS以及将其链接到父-子主题的信息。就我而言:
/*
Theme Name: storefront-child
Theme URI: http://example.com/
Description: StoreFront
Author: John Doe
Author URI: http://example.com
Template: storefront
Version: 1.3.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child
*/
您的子主题似乎没有正确配置。请仔细检查以下几点。
- 您激活了子主题(不是父主题)
-
你的孩子主题有一个style.css文件,下面的代码是
/* Theme Name: My Child Theme Description: A Twenty Thirteen child theme Author: My author Template: twentythirteen Version: 1.0.0 */
-
您正确地排列了样式和脚本。
add_action( 'wp_enqueue_scripts', 'my_theme_add_stylesheet' ); function my_theme_add_stylesheet() { wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/style.css', false, '1.0', 'all' ); }