wordpress - attach css to page template

Discussion in 'HTML & Website Design' started by Ruriko, Jan 12, 2008.

  1. #1
    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?
     
    Ruriko, Jan 12, 2008 IP
  2. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #2
    just make a new css file and attach that to the page instead of the main css file (or as well as)
     
    twistedspikes, Jan 12, 2008 IP
    timsdd likes this.
  3. mich_alex

    mich_alex Well-Known Member

    Messages:
    511
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #3
    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 } ?>
    Code (markup):
    note:
    you also must have styling for footer,header,etc for the theme in custom.css so i won't break.
     
    mich_alex, Jan 13, 2008 IP
  4. Valve-Hosting

    Valve-Hosting Peon

    Messages:
    1,071
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can do what mich said , but if you have CSS + JS to add, I use a

    use:


    and then make an extra .php with all of the <head> includes ;)
     
    Valve-Hosting, Jan 13, 2008 IP