Share Prices - Credit Counseling - Advertising - Król Szamanów - Free Advertising

PDA

View Full Version : wordpress - attach css to page template


Ruriko
Jan 12th 2008, 9:20 pm
I'm using wordpress and I made a custom page template and I want to attach a different css style to it instead of using the main style.css. How can I do this?

twistedspikes
Jan 12th 2008, 10:38 pm
just make a new css file and attach that to the page instead of the main css file (or as well as)

mich_alex
Jan 13th 2008, 2:50 am
you can try this hack
open header.php and find the first stylesheet tag

<?php if (is_page('your-page-id')) { ?>

<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/custom.css" type="text/css" media="screen" title="custom"/>

<?php } else { ?>

<!-- this is deafult css for all blog page -->

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

<?php } ?>

note:
you also must have styling for footer,header,etc for the theme in custom.css so i won't break.

Valve-Hosting
Jan 13th 2008, 4:46 am
You can do what mich said , but if you have CSS + JS to add, I use a

use:


<?php if ( is_page('contact') ) { include ('includes/extra-css.php'); } ?>

and then make an extra .php with all of the <head> includes ;)