I am trying to get this to work across multiple pages using the same theme with minimal changes to the header.php file:
<?php
if ( is_page( 'archives' ) ) {
echo '<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style-archives.css" />';
}
elseif ( is_page( 'sitemap' ) ) {
echo '<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style-sitemap.css" />';
}
?>
However when I test the code each page that I'm referencing is showing the PHP string in the href instead of the directory:
<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style-sitemap.css" />
It should read:
<link type="text/css" rel="stylesheet" href="http://website.com/wp-content/themes/childtheme/style-sitemap.css" />