简体   繁体   English

WordPress的儿童主题问题

[英]Wordpress child theme issue

I'm using a self made child theme for my Wordpress theme. 我正在为Wordpress主题使用自制的子主题。 Because I've so much files I've added some folders to my child theme and changed the path in the functions.php to make it a little bit clearer: 因为文件太多,所以我向子主题添加了一些文件夹,并更改了functions.php中的路径,以使其更加清晰:

在此处输入图片说明


My folder structure: 我的文件夹结构:

在此处输入图片说明

Now I have the problem that Wordpress having issues loading my files: 现在,我遇到了Wordpress在加载文件时遇到问题的问题:

(index):53 GET http://localhost/wordpress/wp-content/themes/Divicss/style.css?ver=4.9.8 net::ERR_ABORTED 404 (Not Found)

It loooks like that Wordpress is searching in the original theme but this is wrong. 它看起来像Wordpress正在搜索原始主题,但这是错误的。 How can I fix this? 我怎样才能解决这个问题? Or is this even possible? 还是有可能吗?

get_template_directory_uri returns the path to parent theme. get_template_directory_uri返回父主题的路径。 You have to use get_stylesheet_directory_uri . 您必须使用get_stylesheet_directory_uri Also, keep in mind it doesn't append slashes at the end, so you have to do it yourself. 另外,请记住,它不会在末尾添加斜杠,因此您必须自己做。

wp_enqueue_style('main_css', get_stylesheet_directory_uri() . '/css/style.css');

According to the developer documentation style.css is a required file, so maybe you can't move that particular file after all, or at least need a dummy one with the child's stanza. 根据开发人员文档, style.css是必需文件,因此也许您最终无法移动该特定文件,或者至少需要一个带有孩子节的虚拟文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM