• I’m having some issues with the conditional below, can someone please take a look at it? Based on the code I want it to display one stylesheet for either of the first two templates or a different one for either of the second 2. As it is now it always displays the first style sheet…

    <?php
    	if (is_page_template('digest.php' || 'digest-page.php')) {
    	?>
    	<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/customCss/digest.css" type="text/css" media="screen" />
    	<?php
    	}
    	else if (is_page_template('it.php' || 'it-page.php')) {
    	?>
    	<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/customCss/it.css" type="text/css" media="screen" />
    	<?php
    	}
    	?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter frescova

    (@frescova)

    one minor addition – Ideally what I want is for all sub-pages of file-1.php or all sub pages of file-2.php to use the corresponding stylesheet,

    so if page template is file-1.php or any of its sub pages use css 1

    if page template is file-2.php or any of its sub pages use css 2

    Thanks in advance for any guidance…

    Has someone found a way to make conditional CSS based on “is_page_template” to work? I am trying to load only css page “x” to certain templates…

    I was trying:

    <?php
    if ( is_page_template('single-video.php')) {
    echo '<link rel=”stylesheet” href=”',bloginfo("template_directory"),'/css/video.css” type=”text/css” />';
    } ?>

    or

    <?php
    if ( is_page_template('single-video.php')) { ?>
    <link rel=”stylesheet” href=”<?php bloginfo(‘template_directory’); ?>/css/video.css” type=”text/css”  />
    <?php } ?>

    to no avail… It seems not to even send it to the browser.

    Is this just not even possible (with or without the “echo” in the header)?
    (thinking that being pre-“Body”, the php is not parsing… )

    Any hint in a direction would help…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_page_template conditional’ is closed to new replies.