/ / Грешка за връзката на URL към CSS файла - javascript, php, html, css, wordpress

Грешка при свързване на URL към CSS файл - javascript, php, html, css, wordpress

Аз съм начинаещ за PHP. Защо не мога да свържа CSS файла с тези кодове? Какво не е наред с моя код? Може ли някой да ми помогне?

header.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>
<p><link rel="stylesheet" type="text/css" href="<?php bloginfo("stylesheet_directory"); ?>/css/skel.css" /></p>
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/style.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/style-desktop.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/style-mobile.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/fakeLoader.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/gravity-forms-bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/default.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/component.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/foundation-flex.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/foundation.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/foundation.min.css" />
</noscript>
</head>

Предполага се, чеlocalhost / wordpress / wp-content / themes / Beyond / css / style.css (правилен URL адрес), но сега се свързва към localhost / wordpress / sample-page / css / style.css (грешен URL). Как да промените връзката, за да коригирате URL адреса? Wordpress може да зареди моя Javascript, но не може да зареди моя CSS файл.

URL адрес за свързване на CSS файл Директория на файлове

Отговори:

-1 за отговор № 1

Липсва ви изявлението за ехо. Опитайте да промените това:

<link rel="stylesheet" type="text/css" href="<?php bloginfo("template_directory");?>/css/style.css" />

до това

<link rel="stylesheet" type="text/css" href="<?php echo bloginfo("template_directory");?>/css/style.css" />

Това помага ли?


0 за отговор № 2
  1. Вземете стойността на вашия директория на шаблона uri в променлива, след което я използвайте в program.if тя не идва просто ехо от стойността $ template_dir и я публикувате тук

     <?php
    $template_dir = get_template_directory_uri();
    ?>
    <link rel="stylesheet" type="text/css" href="<?php echo $template_dir;?>/css/style.css" />