• I have 6 different pages on my website, however I want each page to have very different CSS.

    This is what I currently have in the header, however I notice some CSS happens on other pages when it shouldn’t.

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> 
    
    <?php if ( is_page_template( 'front-page.php' ) ) { ?>
    <link rel="stylesheet" href="<?php bloginfo('front-page.css'); ?>">
    <?php
    } elseif ( is_page_template( 'home.php' ) ) { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/home.css" media="screen" type="text/css" />
    <?php
    } elseif ( is_page_template( 'digital.php' ) ) { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/digital.css" media="screen" type="text/css" />
    <?php
    } elseif ( is_page_template( 'print.php' ) ) { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/print.css" media="screen" type="text/css" />
    <?php
    } elseif ( is_page_template( 'video.php' ) ) { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/video.css" media="screen" type="text/css" />
    <?php
    } else {
    
    }
    
    ?>

    Any suggestions would be greatly appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Multiple CSS files for each .php file (IFELSE)’ is closed to new replies.