Title: is_page_template conditional
Last modified: August 19, 2016

---

# is_page_template conditional

 *  [frescova](https://wordpress.org/support/users/frescova/)
 * (@frescova)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/is_page_template-conditional/)
 * 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](https://wordpress.org/support/users/frescova/)
 * (@frescova)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/is_page_template-conditional/#post-1160590)
 * 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…
 *  [pirazolone](https://wordpress.org/support/users/pirazolone/)
 * (@pirazolone)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/is_page_template-conditional/#post-1161134)
 * 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.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [is_page_template](https://wordpress.org/support/topic-tag/is_page_template/)
 * [Stylesheet](https://wordpress.org/support/topic-tag/stylesheet/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [pirazolone](https://wordpress.org/support/users/pirazolone/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/is_page_template-conditional/#post-1161134)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
