I was expecting to see get_stylesheet_uri()
called somewhere in the default header.php file for the default themes (2012-14), but anything like it is missing, which has me wondering how the reference is added.
The default theme headers have something like this:
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
Looking at the source for the themes, shows a proper link to the stylesheet in the header, so, how does it get there?
The stylesheet is registered and enqueued by a function called
twentyfourteen_scripts()
in the theme’sfunctions.php
.Callbacks hooked into the style loader/dependency system will be
echo
ed on thewp_head
action in thewp_head()
function.Which, by the way, is how you should be loading your own stylesheets. There is a similar system for scripts.