简体   繁体   English

WordPress的样式表包括不工作

[英]Wordpress stylesheet include not working

I have coded a custom site, and am using Wordpress to host. 我已经编码了一个自定义网站,并且正在使用Wordpress进行托管。 Currently, I'm trying to only link index.php and style.css. 目前,我正在尝试仅链接index.php和style.css。 All I get is either a blank page or the html without css. 我得到的只是空白页或没有CSS的html。 CSS is the same directory as index.php. CSS与index.php是同一目录。 What am I doing wrong? 我究竟做错了什么? I've been trying everything. 我一直在尝试一切。

    <!doctype html>
<html>
<head>
<title>Goats for Sale | Clayson Ridge Farm</title>
<meta name="description" content="High-quality, purebred goats by Clayson Ridge Farm. Prize-winning Alpine and Nubian goats for sale. We ship all across Canada. Reserve your goat today." />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/style.css" media="screen" />

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
</head>

Try this i thing you use stylesheet_url 试试这个,我用stylesheet_url

admin_email          = admin@example.com
atom_url             = http://www.example.com/home/feed/atom
charset              = UTF-8
comments_atom_url    = http://www.example.com/home/comments/feed/atom
comments_rss2_url    = http://www.example.com/home/comments/feed
description          = Just another WordPress blog
home                 = http://www.example.com/home (DEPRECATED! use url option instead)
html_type            = text/html
language             = en-US
name                 = Testpilot
pingback_url         = http://www.example.com/home/wp/xmlrpc.php
rdf_url              = http://www.example.com/home/feed/rdf
rss2_url             = http://www.example.com/home/feed
rss_url              = http://www.example.com/home/feed/rss
siteurl              = http://www.example.com/home (DEPRECATED! use url option instead)
stylesheet_directory = http://www.example.com/home/wp/wp-content/themes/largo
stylesheet_url       = http://www.example.com/home/wp/wp-content/themes/largo/style.css
template_directory   = http://www.example.com/home/wp/wp-content/themes/largo
template_url         = http://www.example.com/home/wp/wp-content/themes/largo
text_direction       = ltr
url                  = http://www.example.com/home
version              = 3.5
wpurl                = http://www.example.com/home/wp

Replace 更换

<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>" media="screen" />

Try This 尝试这个

<link rel="stylesheet" type="text/css" href="<?php  get_stylesheet_directory_uri(); ?>/style.css" media="screen" />

get_stylesheet_directory_uri() => this return your template directory path than you need style.css. get_stylesheet_directory_uri()=>这将返回模板目录路径,而不是需要的style.css。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM