Multiple CSS files and if statements
-
Hi,
I need to load three different stylesheets depending on the page.
I’ve added the
<?php body_class($class); ?>
tag to my body and have the following statement in the head:<?php if( is_home() ) { ?> <link rel="stylesheet" type="text/css" media="all" href="<?php echo get_stylesheet_directory_uri(); ?>/css/frontpage.min.css" /> <?php } else { ?> <link rel="stylesheet" type="text/css" media="all" href="<?php echo get_stylesheet_directory_uri(); ?>/css/internal.min.css" <?php } ?>
The problem is that I also have a global stylesheet that I need to load using the code:
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
This works well if I load the global sheet before the others, but if I try to load it after the if statement WordPress just ignores it.
I need to load it after the other styles so that things cascade correctly.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multiple CSS files and if statements’ is closed to new replies.