Problem using separate style sheet for multiple pages
-
I have been using a standard 2 column theme with a sidebar on the right. Now getting further into my page customization I need to be able to remove the side back and make certain pages a single column. So far I have been able to create a new page template and remove the side bar. I also created a new style sheet which should make the page a single column, I am currently stuck at how to call the correct style sheet. I will let you know that I am new to xhtml, php and such.
I have copied the code from my header file which seems to be controlling and choosing the style sheet used. The name of my new style sheet is forum.css how can I incorporate this into the if statement. I would like to be able to state that if the current page is forum.php then use style sheet forum.css. Any ideas?
<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”all” />
<!–[if IE 6]>
<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/ie6.css” type=”text/css” />
<![endif]–>
-
Assuming that these new templates are for pages, you could load stylesheets based on the page name:
<?php if( is_page('Forum') ) :?><link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>"/forum.css type="text/css" media="all" /> <?php else :?><link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all" /> <?php endif;?>So like I said I am a beginner at all off this, where would I add the code in the header.php file where it calls the rest of the style sheets. Or should I add it into the actual forum.php file?
Add it to header.php in place of the standard call to the theme stylesheet.
Awsome that worked there was one thing missing but I figured that out. No I have another question I would like to use this same style sheet for multiple pages so I figured I could use is_pages(array()). The code is below, the only thing is that the style sheet will not apply to any additional pages accept for forum.php.
<?php if ( is_page(array('Forum','Shopping')) ) :?><link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/wide.css" type="text/css" media="all" /> <?php else :?><link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all" /> <?php endif;?>
The topic ‘Problem using separate style sheet for multiple pages’ is closed to new replies.