如何修复与设置 WordPress 子主题相关的这些错误消息?

发布于 2024-11-20 00:29:08 字数 971 浏览 3 评论 0原文

我执行了以下步骤来设置我的 WordPress 子主题;但是,我收到以下错误消息:

1)在我的主题目录中创建了一个名为 canvas-child 的文件夹
2) 在此 canvas-child 目录中创建一个 style.css 文件,并将以下代码放在 .css 文件的顶部:

@import "../canvas/style.css";
/*
Theme Name: Canvas Child Theme
Theme URI: http://www.example.com/
Version: 1.0
Description: Custom Theme based on Canvas
Author: My Name
Author URI: http://www.example.com
Template: canvas
*/

3) 进入我的 WP 管理并激活此子主题...但是我收到以下错误:

Warning: fopen(http://www.example.com/wp-content/themes/canvas-child/style.css) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in example.com/html/wp-includes/functions.php on line 4339

Warning: fread(): supplied argument is not a valid stream resource in example.com/html/wp-includes/functions.php on line 4342

Warning: fclose(): supplied argument is not a valid stream resource in example.com/html/wp-includes/functions.php on line 4345

I did the following steps to setup my WordPress child theme; however, I am receiving these error messages:

1) created a folder called canvas-child in my themes directory
2) created a style.css file within this canvas-child directory and put the following code at the top of the .css file:

@import "../canvas/style.css";
/*
Theme Name: Canvas Child Theme
Theme URI: http://www.example.com/
Version: 1.0
Description: Custom Theme based on Canvas
Author: My Name
Author URI: http://www.example.com
Template: canvas
*/

3) Went into my WP admin and activated this child theme...however I receive these errors:

Warning: fopen(http://www.example.com/wp-content/themes/canvas-child/style.css) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in example.com/html/wp-includes/functions.php on line 4339

Warning: fread(): supplied argument is not a valid stream resource in example.com/html/wp-includes/functions.php on line 4342

Warning: fclose(): supplied argument is not a valid stream resource in example.com/html/wp-includes/functions.php on line 4345

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜是你 2024-11-27 00:29:08

将您的 @import "../canvas/style.css"; 移至注释块下方:

/*
Theme Name: Canvas Child Theme
Theme URI: http://www.example.com/
Version: 1.0
Description: Custom Theme based on Canvas
Author: My Name
Author URI: http://www.example.com
Template: canvas
*/
@import "../canvas/style.css";

Move your @import "../canvas/style.css"; to below the comment block:

/*
Theme Name: Canvas Child Theme
Theme URI: http://www.example.com/
Version: 1.0
Description: Custom Theme based on Canvas
Author: My Name
Author URI: http://www.example.com
Template: canvas
*/
@import "../canvas/style.css";
七秒鱼° 2024-11-27 00:29:08

所有,我想通了......我的网站受到用户名和密码的密码保护。我删除了身份验证,现在工作正常:) 谢谢您的帮助

All, I figured it out...My website was password protected with a username and password. I removed the authentication and it works fine now :) Thank you for your help

故人如初 2024-11-27 00:29:08

您不需要使用导入,WP 会自动完成。

You don't need to use import, WP does it automatically.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文