Multiple CSS files and Conditional Tags
-
Hi everybody,
if code is poetry I’m learning the ABC modifying a theme.
Right now I’m trying to use 2 different CSS files. Style.css with the sidebar and style2.css without the sidebar and with a slightly different page layout.
Style.css is for blog and posts and style2.css is for specific pages with a certain page template (blank.php).I’m trying to use conditional tags in the header, something like:
Option1<?php if( is_page_template('blank.php') ) :?> <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style2.css" media="screen" type="text/css" /> <?php endif;?>
But it doesn’t work.
I’ve laso tried the other way round (inverting Css files names) setting up this:
Option2<?php if( is_home() ) :?> <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style2.css" media="screen" type="text/css" /> <?php endif;?>
This way it works but I get my sidebar only in the main posts page, not in single posts.
To load sidebar’s content and widgets I obviously modify the page.php & page template blank.php when needed adding or deleting the load sidebar code line.Is there anybody who could explain me why option1 doesn’t work and help me to fix it?
Thanks in advance
- The topic ‘Multiple CSS files and Conditional Tags’ is closed to new replies.