Reputation: 317
Can anybody help me make this work, the idea is , if a post, retrieve one stylesheet, if the homepage another, if not, assume it's a page and use that stylesheet. the home and the post ones work, but it detects the pages as the homepage and not a page, any help?
<?php
if ( ! is_single() ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/styles/pageSpecific/index.css">
<?php
} elseif ( ! is_home() ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/styles/pageSpecific/post.css" media="screen" type="text/css" />
<?php } else { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/styles/pageSpecific/page.css" media="screen" type="text/css" />
<?php }?>
thanks!
Upvotes: 0
Views: 4129
Reputation: 5781
Seems odd the way it is being used... Try the following (taking the ! out of the if/else
<?php if ( is_single() ) { ?>
//your stylesheet for single
<?php } elseif ( is_home() ) { ?>
//Your stylesheet for home
<?php } else { ?>
//Your everything else stylesheet
<?php }?>
using the ! you are going to get this logic if is not single //anything that is not a home or page will apply this so it will not get to the else
using it without the ! will go clear to the else statement if it is not a single or home. Then it will apply the stylesheet of the else. the way you have it . if you are seeing your homepage, it is not a single so it will stop there.
Upvotes: 2