I have been trying to create a WordPress theme but linking to style.css within header.php doesn't seems to work, the header just doesn't appear. Used more than 30 codes even the ones provided by WordPress and people with similar errors but it seems like the solutions are outdated.
<link href="<?php bloginfo('stylesheet_url'); ?>" rel = "stylesheet">
This is my PHP script
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-default navbar-static-top">
<div class="container"> <a href="#" class="navbar-brand">Logo</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse"> <span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#">Home</a>
</li>
<li><a href="#">Contact</a>
</li>
<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social Media<b class = "caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Facebook</a>
</li>
<li><a href="#">Instagram</a>
</li>
<li><a href="#">Twitter</a>
</li>
<li><a href="#">Google Plus</a>
</li>
</ul>
</li> <a href="http://www.adds.com" class="navbar-btn btn-success btn pull-right">Add</a>
</ul>
</div>
</div>
</div>
<div class="container">
Your theme style.css
is included by default by the WordPress by wp_head()
function. Before you end your HEAD tag add this function.
<?php wp_head(); ?>
If you want to add additional stylesheets then use this function in your functions.php
file.
function additional_custom_styles() {
/*Enqueue The Styles*/
wp_enqueue_style( 'uniquestylesheetid', get_template_directory_uri() . '/css/custom.css' );
}
add_action( 'wp_enqueue_scripts', 'additional_custom_styles' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With