简体   繁体   English

为什么Wordpress无法加载资源? 它说服务器响应状态为404(未找到)

[英]why Wordpress failed to load the resource? It said that the server responded with a status of 404 (not Found)

I'm beginner for developing website by using Wordpress. 我是使用Wordpress开发网站的初学者。 I follow the steps by steps in this URL: www.siteground.com/tutorials/wordpress/wordpress_create_theme.htm 我将按照以下URL中的步骤进行操作:www.siteground.com/tutorials/wordpress/wordpress_create_theme.htm

I have downloaded some template from other website. 我已经从其他网站下载了一些模板。 After I integrate with Wordpress, I also modify the code and adding some php code into it. 与Wordpress集成后,我还修改了代码并向其中添加了一些php代码。

<html lang="en">
<head>
    <title> </title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="description" content="Bootstrap 3 responsive centered columns">
    <meta charset="UTF-8" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="author" content="Codrops" />
    <script>
    var template_dir_js = "<?php echo get_template_directory_uri();?>";
    </script>
    <!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery.min.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery.dropotron.min.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/jquery.slidertron.min.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/skel.min.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/skel-layers.min.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/init.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/bootstrap.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/modernizr.custom.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/foundation.js" type="text/javascript"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/foundation.min.js" type="text/javascript"></script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="generator" content="PSPad editor, www.pspad.com">
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src='https://www.google.com/recaptcha/api.js'></script>
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
      <link rel="shortcut icon" href="../favicon.ico">         
             <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>            
        <noscript>
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/skel.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/style.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/style-desktop.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/style-mobile.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/fakeLoader.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/bootstrap.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/bootstrap-theme.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/gravity-forms-bootstrap.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/default.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/component.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/foundation-flex.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/foundation.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('template_directory');?>/css/foundation.min.css" />
    </noscript>
</head>
<!-- Header Wrapper -->
        <div id="header-wrapper">
            <div class="container">
                <div class="row">
                    <div class="12u">

                        <!-- Header -->
                            <header id="header">

                                <!-- Logo -->
                                    <h1><a href="index.html" id="logo">Beyond</a></h1>

                                <!-- Nav -->
                                    <nav id="nav">
                                        <ul>
                                            <li class="current_page_item"><a href="index.html">Home</a></li>
                                            <li>
                                                <a href="" class="arrow">Dropdown</a>
                                                <ul>
                                                    <li><a href="#">Lorem ipsum dolor</a></li>
                                                    <li><a href="#">Magna phasellus</a></li>
                                                    <li><a href="#">Etiam dolore nisl</a></li>
                                                    <li>
                                                        <span class="arrow">Phasellus consequat</span>
                                                        <ul>
                                                            <li><a href="#">Lorem ipsum dolor</a></li>
                                                            <li><a href="#">Phasellus consequat</a></li>
                                                            <li><a href="#">Magna phasellus</a></li>
                                                            <li><a href="#">Etiam dolore nisl</a></li>
                                                            <li><a href="#">Veroeros feugiat</a></li>
                                                        </ul>
                                                    </li>
                                                    <li><a href="#">Veroeros feugiat</a></li>
                                                </ul>
                                            </li>
                                            <li><a href="left-sidebar.html">Left Sidebar</a></li>
                                            <li><a href="right-sidebar.html">Right Sidebar</a></li>
                                            <li><a href="no-sidebar.html">No Sidebar</a></li>
                                        </ul>
                                    </nav>

                            </header>

                        <!-- Banner -->
                            <div id="banner">
                                <div class="caption">
                                    <h2>Sed <span>nullam</span></h2>
                                    <p>Felis temper matinos elemer feugiat</p>
                                </div>
                            </div>

                    </div>
                </div>
            </div>
        </div>

It shows me the error: 它显示了我的错误:

jquery.slidertron.min.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/wordpress/sample-page/css/style.css Failed to load resource: the server responded with a status of 404 (Not Found)

that means the css and javascript will not be read. 这意味着将不会读取CSS和javascript。 Is there any solution for this error? 这个错误有解决方案吗? I have tried many times but also cannot solve it. 我已经尝试了很多次,但也无法解决。 Please teach me how to solve this error. 请教我如何解决此错误。 I need some help. 我需要协助。 Thank you 谢谢

File directory CSS File 文件目录 CSS文件

WordPress has an asset pipeline that's based on enqueueing assets. WordPress具有基于排队资产的资产管道。 See more on this here . 在这里查看更多

Rather than adding stylesheet calls to your header template you need to add them to the enqueue file instead. 无需将样式表调用添加到标题模板,而是需要将其添加到入队文件。 Same with additional javascripts. 与其他javascript相同。 Doing it this way means WordPress is aware of, and can easily work with, your assets. 以这种方式进行操作意味着WordPress知道并可以轻松使用您的资产。

Also make sure you've set up a child theme based on the original theme rather than working on the original. 另外,请确保您已基于原始主题设置了子主题,而不是在原始主题上进行操作。 Then when that original theme is updated your changes aren't erased. 然后,当原始主题更新时,您的更改不会被删除。 More on child themes here . 更多有关儿童主题的信息

Style.css tells WordPress on load the name of your theme or child theme and is required, so don't ever move or remove style.css from the theme's root directory. Style.css告诉WordPress在加载时是您的主题或子主题的名称,这是必需的,因此请不要从主题的根目录移动或删除style.css。

暂无
暂无

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

相关问题 程序无法加载无法加载资源:服务器以404(未找到)状态响应 - Program will not load Failed to load resource: the server responded with a status of 404 (Not Found) Node.js服务器:无法加载资源:服务器以状态404(未找到)响应 - Nodejs server: Failed to load resource: the server responded with a status of 404 (Not Found) Angular.js库无法加载资源:服务器响应状态为404(未找到) - Angularjs libs Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器响应状态 404(未找到) - Failed to load resource: the server responded with a status 404(not found) 加载资源失败:服务器响应状态为 404(未找到) - Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器响应状态为 404(未找到)GoogleBooks Api - Failed to load resource: the server responded with a status of 404 (Not Found) GoogleBooks Api 无法加载资源:服务器响应状态为 404(未找到),显示在控制台上 - Failed to load resource: the server responded with a status of 404 (Not Found) displayed on console Rails ajax:无法加载资源:服务器以状态404(未找到)响应 - Rails ajax: Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器以 404(未找到)状态响应 nodejs - Failed to load resource: the server responded with a status of 404 (Not Found) with nodejs Apache Cordova:“无法加载资源:服务器以404(未找到)状态响应” - Apache Cordova: “Failed to load resource: the server responded with a status of 404 (Not Found)”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM