gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 04:09:31 26 4
gpt4 key购买 nike

我是使用 Wordpress 开发网站的初学者。我按照此 URL 中的步骤操作:www.siteground.com/tutorials/wordpress/wordpress_create_theme.htm

我从其他网站下载了一些模板。与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>

它告诉我错误:

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)

这意味着 css 和 javascript 将不会被读取。这个错误有什么解决办法吗?我试了很多次也解决不了。请教我如何解决这个错误。我需要一些帮助。谢谢

File directory CSS File

最佳答案

WordPress 有一个基于排队 Assets 的 Assets 管道。 See more on this here .

您需要将样式表调用添加到队列文件中,而不是将样式表调用添加到您的 header 模板中。与其他 javascripts 相同。这样做意味着 WordPress 知道并可以轻松地使用您的 Assets 。

还要确保您已经根据原始主题设置了子主题,而不是在原始主题上工作。然后,当更新原始主题时,您的更改不会被删除。 More on child themes here .

Style.css 在加载时告诉 WordPress 您的主题或子主题的名称并且是必需的,因此永远不要从主题的根目录中移动或删除 style.css。

关于javascript - 为什么 Wordpress 无法加载资源?它表示服务器响应状态为 404(未找到),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42782037/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com