简体   繁体   中英

Linking CSS in Wordpress with PHP and bloginfo()

I'm attempting to link my CSS file with my header.php file for a Wordpress site I'm working on, but I'm having a little trouble following along.

I was told to set it up like so:

<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">

Below is my current code:

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

However if you look at the current state of the site, http://thenerdup.com , it's obvious that the CSS file is not linked properly.

For what it's worth, this is the tutorial I'm following along with: http://blog.teamtreehouse.com/responsive-wordpress-bootstrap-theme-tutorial

I'm currently on the part about editing the header.

Thanks for any help.

Actually it should be

<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">

So it'll echo/print the url of your stylesheet .

Here bloginfo() is a function and stylesheet_url is a parameter of this function. There are other parameters too, for example if you write bloginfo('name') then it'll print the name of your blog.

Also you can use

<link href="<?php echo get_stylesheet_uri();?>" rel="stylesheet">

Read more at Codex .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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