The theme i'm using supports only one primary header menu. I'm trying to make another one using another one using external css . How can i link external css in wordpress theme.
Asked
Active
Viewed 2.4k times
2 Answers
14
Your best option would be to enqueue the file onto the page you want.
In the functions.php file, add this code
// Register style sheet.
add_action( 'wp_enqueue_scripts', 'register_custom_plugin_styles' );
/**
* Register style sheet.
*/
function register_custom_plugin_styles() {
wp_register_style( 'my-stylesheet', 'STYLESHEETS URL' );
wp_enqueue_style( 'my-stylesheet' );
}
If you only want this on specific pages, then you'll need to put it round an if statement checking what page you are currently on to know if to run the above script.
Read more about enqueuing scripts here: http://codex.wordpress.org/Function_Reference/wp_register_style

Stewartside
- 20,378
- 12
- 60
- 81
2
You can use enqueue or you can go to your theme's style.css
file and then inside you would use the @import
at-rule to link to.
Example:
@import url("//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css");
Alternatively you could edit the header.php
file in the theme to link to an external stylesheet.
Example:
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

Aibrean
- 6,297
- 1
- 22
- 38
-
http://stackoverflow.com/questions/11709625/is-using-import-declarations-a-bad-practice – Frederik Spang Nov 20 '14 at 17:25
-
1Yes, alternatively you could edit the `header.php` file in the theme to link to an external stylesheet. – Aibrean Nov 20 '14 at 17:26