Hi Does anybody can tell me how do I link in Wordpress to two different pages to different style sheet.I would like to have different layout in home page but rest of the pages would remain and have defaults styles.css.Where do I place link that link up external sheet for it? Wordpress is using same styles everywhere .Any help or suggestions here please? Thnax
Does anybody can tell me how do I link in Wordpress to two different pages to different style sheet.I would like to have different layout in home page but rest of the pages would remain and have defaults styles.css.Where do I place link that link up external sheet for it? Wordpress is using same styles everywhere .Any help or suggestions here please?
Thnax
2. Open up header.php and find where your stylesheet is being linked from.
Change:
<link rel=\"stylesheet\" type=\"text/css\" href=\"<?php bloginfo('stylesheet_url'); ?>\" media=\"screen\" />To:
<?php if ( is_page(id#) ) {echo '<link rel=\"stylesheet\" type=\"text/css\" href=\"<?php bloginfo('template_directory'); ?>/your-special-file.css\" media=\"screen\" />';
}
else {
echo '<link rel=\"stylesheet\" type=\"text/css\" href=\"<?php bloginfo('stylesheet_url'); ?>\" media=\"screen\" />';
}
endif ?>
I'm not a PHP guru, but that should work.
Just to make sure my PHP is wrong and nothing else, did you replace "id#" with your home page's id?
Give this one a go:
<?php if ( is_page(id) ) {echo '<link rel=\"stylesheet\" type=\"text/css\" href=\"' . bloginfo('template_directory') . '/your-special-file.css\" media=\"screen\" />';
}
else {
echo '<link rel=\"stylesheet\" type=\"text/css\" href=\"' . bloginfo('stylesheet_url') . 'media=\"screen\" />';
}
endif ?>
sorry i didn't explain myself.
this works really well.
Here's another one, from Chris' book Digging into WordPress.
Conditionally loading extra CSS files
<?php if (is_page_template(\"page-snippet.php\")){ ?><link rel=\"stylesheet\" type=\"text/css\"
href=\"<?php bloginfo('stylesheet_directory'); ?>/css/snippets.css\" />
<?php } ?>
Yes, sorry, forgot to update that. Too quick with my copy and paste!
Should also mention that when using that method, it means you'll have two stylesheets being loaded at the same time.