Forums

different css on one page (6 posts)

  1. jamesy155
    Member
    Posted 3 years ago #

    My apologies if this is in the wrong section.

    for one page on my site I wish to use a different theme, as this page is sort of seperate. What would be best is if I could a load an entirely different CSS, from within the same theme directory.

    for example if_home - style.css
    if_page "movies-and-media" - style2.css.

    thank you for any help supplied, I've been googling all afternoon before realising I might have to ask a real person instead of a search engine :).

  2. stvwlf
    Member
    Posted 3 years ago #

    Hi

    one way is to set up some PHP code in the <head> section in your header.php file.

    find the line that declares style.css and change the single line to something like this:

    <?php if ( is_page('movies-and-media') ) { ?>
         {put the declaration line for style2.css here}
    <?php } else { ?>
         {put the declaration line for style.css here}
    <?php } ?>
  3. maxy
    Member
    Posted 2 years ago #

    Mine seems to be more complicated (I want to do the same). Can anyone help?

    http://www.joecrogan.com

  4. maxy
    Member
    Posted 2 years ago #

    I cant locate any line in my header.php that declares style.css?

  5. alchymyth
    The Sweeper
    Posted 2 years ago #

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

    to use a special style sheet for a special page, change it a bit and combine this with the solution from above:

    <?php if ( is_page('special-page') ) { ?>
         <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/style2.css" type="text/css" media="screen" />
    <?php } else { ?>
         <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <?php } ?>
  6. maxy
    Member
    Posted 2 years ago #

    Thanks so much, its worked perfectly!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic