-6ren">
gpt4 book ai didi

php - 为什么 bloginfo ('stylesheet_url' ) 没有呈现我的 style.css?

转载 作者:太空宇宙 更新时间:2023-11-04 09:23:19 24 4
gpt4 key购买 nike

根据 WordPress 法典,我应该能够使用 style.css 进行渲染,但它无法正常工作,控制台中也没有渲染任何内容。

这是我的 header.php:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>

<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php bloginfo('name'); ?> | <?php is_front_page() ? bloginfo('description') : wp_title(''); ?></title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

<!-- Place favicon.ico and apple-touch-icon(s) here -->

<link rel="shortcut icon" href="http://cdn.ink.sapo.pt/3.1.10/img/favicon.ico">
<link rel="apple-touch-icon" href="http://cdn.ink.sapo.pt/3.1.10/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="http://cdn.ink.sapo.pt/3.1.10/img/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="http://cdn.ink.sapo.pt/3.1.10/img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="http://cdn.ink.sapo.pt/3.1.10/img/touch-icon-ipad-retina.png">
<link rel="apple-touch-startup-image" href="http://cdn.ink.sapo.pt/3.1.10/img/splash.320x460.png" media="screen and (min-device-width: 200px) and (max-device-width: 320px) and (orientation:portrait)">
<link rel="apple-touch-startup-image" href="http://cdn.ink.sapo.pt/3.1.10/img/splash.768x1004.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
<link rel="apple-touch-startup-image" href="http://cdn.ink.sapo.pt/3.1.10/img/splash.1024x748.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">

<!-- load Ink's css from the cdn -->
<link rel="stylesheet" type="text/css" href="http://cdn.ink.sapo.pt/3.1.10/css/ink-flex.min.css">
<link rel="stylesheet" type="text/css" href="http://cdn.ink.sapo.pt/3.1.10/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>">


<!-- load Ink's javascript files from the cdn -->
<script type="text/javascript" src="http://cdn.ink.sapo.pt/3.1.10/js/holder.js"></script>
<script type="text/javascript" src="http://cdn.ink.sapo.pt/3.1.10/js/ink-all.min.js"></script>
<script type="text/javascript" src="http://cdn.ink.sapo.pt/3.1.10/js/autoload.js"></script>

这是我的 index.php 的一部分:

<?php get_header(); ?>

<form action="" class="ink-form">
<div class="ink-grid">
<div class="panel">
<div class="control-group append-button"></div>
<div class="control all-100">
<input type="text" name="s" placeholder="Search news...">
</div>
</div>
</div>
</form>

<div class="ink-grid vertical-space">


<div class="panel">
<h2>Recent News</h2>
<div id="car1" class="ink-carousel" data-space-after-last-slide="false" data-autoload="false">

<ul class="stage column-group half-gutters">
<?php while(have_posts()) : the_post(); ?>
<li class="slide xlarge-25 large-25 medium-33 small-50 tiny-100">
<?php the_post_thumbnail('news-thumb', array(

'class' => 'half-bottom-space')); ?>
<div class="description">
<h4 class="no-margin"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h4>
<h5 class="slab"><?php the_time('F j, Y g:i a'); ?></h5>
<div class="excerpt"><?php the_excerpt(); ?></div>
</div>
</li>
<?php endwhile; ?>

</ul>

</div>

<nav id="p1" class="ink-navigation">
<ul class="pagination black">
</ul>
</nav>

</div>

<div class="panel ink-grid">
<div class="column-group">
<div class="all-50">

这是我的 single.php:

<?php get_header(); ?>

<form action="" class="ink-form">
<div class="ink-grid">
<div class="panel">
<div class="control-group append-button"></div>
<div class="control all-100">
<input type="text" name="s" placeholder="Search news...">
</div>
</div>
</div>
</form>

<div class="ink-grid vertical-space">


<div class="panel">
<h2>Recent News</h2>
<div id="car1" class="ink-carousel" data-space-after-last-slide="false" data-autoload="false">

<ul class="stage column-group half-gutters">
<?php while(have_posts()) : the_post(); ?>
<li class="slide xlarge-25 large-25 medium-33 small-50 tiny-100">
<?php the_post_thumbnail('news-thumb', array(

'class' => 'half-bottom-space')); ?>
<div class="description">
<h4 class="no-margin"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h4>
<h5 class="slab"><?php the_time('F j, Y g:i a'); ?></h5>
<div class="excerpt"><?php the_excerpt(); ?></div>
</div>
</li>
<?php endwhile; ?>

</ul>

</div>

<nav id="p1" class="ink-navigation">
<ul class="pagination black">
</ul>
</nav>

</div>

<div class="panel ink-grid">
<div class="column-group">
<div class="all-50">

最佳答案

使用 get_template_directory_uri() 代替 bloginfo()

get_template_directory_uri() 会给你当前的主题 url 到 style.css

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

关于php - 为什么 bloginfo ('stylesheet_url' ) 没有呈现我的 style.css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41356211/

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