【问题标题】:CSS Stylesheets on Wordpress Production server not loadingWordPress 生产服务器上的 CSS 样式表未加载
【发布时间】:2014-03-13 20:06:30
【问题描述】:

您好,我的 wordpress 网站遇到了一个奇怪的问题。我正在使用 wp-bootstrap 的子主题。当我将网站上传到我的共享主机时,wordpress 似乎正在从我的本地主机中提取 css。换句话说,该站点在我的本地计算机上加载,但是,在任何其他计算机上,样式表都不起作用并且页面看起来一团糟。如果我看源码,地址是:

<link rel="stylesheet" id="bootstrap-css" >>href="http://**localhost**/wordpress/wp_content/themes/wordpress-bootstrap-master/library/css/bootstrap.css?ver=1.0" type="text/css" media="all">

代替:

<link rel="stylesheet" id="bootstrap-css" >>href="http://**www.mydomain.com**/wordpress/wp_content/themes/wordpress-bootstrap-master/library/css/bootstrap.css?ver=1.0" type="text/css" media="all">

有人知道这里可能发生了什么以及任何可能的修复吗?

谢谢!

【问题讨论】:

  • 您是否将数据库直接从本地转储到生产环境?它可能有 localhost 作为网站 url?
  • 是的,我做到了。原谅我,但我有点 wp noob。我将在哪里更改数据库结构?
  • 看看这个wpbeginner.com/wp-tutorials/…特别是这部分-Step 5: Changing the Site URL
  • 其实我想通了。谢谢你的帮助。这解决了我的问题。

标签: css wordpress


【解决方案1】:

我会在根目录中检查您的 styles.css 文件。我的默认 css 文件如下所示:

/*
Theme Name: MDA
Theme URI: http://zachjanice.com
Description: A website using Bootstrap 3 built for the MDA of Kansas City
Author: Zach Janice
Author URI: http://zachjanice.com/
Version: 1.0
Tags: responsive, bootstrap
*/

@import url('css/bootstrap.min.css');
@import url('css/style.css');

您需要css文件的顶级信息才能注册。如果您的引导/自定义 css 文件位于名为“css”的文件夹中,Wordpress 将为您提取这些文件,而无需注册每个 css 文件。

这里是一个可能有帮助的法典链接。 https://codex.wordpress.org/Child_Themes

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-13
    • 2017-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-03
    • 2012-06-25
    • 1970-01-01
    相关资源
    最近更新 更多