Title: WordPress conditional
Last modified: August 20, 2016

---

# WordPress conditional

 *  [mattiafrigeri](https://wordpress.org/support/users/mattiafrigeri/)
 * (@mattiafrigeri)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/wordpress-conditional/)
 * Hi,
 * I am trying to load a CSS file only for a specific post template, I called it:
 * single-photograpy.php
 * which is a custom post template only for pictures posts.
    In the header.php, 
   I can’t find a way to target it. This will target any single post (also the normal
   posts):
 *     ```
       if (is_single()) { ?>
   
       <link href="<?php bloginfo('template_url'); ?>/css/someCSS.css" rel="stylesheet" type="text/css">
   
       <?php } ?>
       ```
   
 * while this one simply doesn’t work:
 *     ```
       if (is_single('single-photography.php')) { ?>
   
       <link href="<?php bloginfo('template_url'); ?>/css/someCSS.css" rel="stylesheet" type="text/css">
   
       <?php } ?>
       ```
   
 * Is there a way only to target the posts from the single-photography.php custom
   post template?
 * _[Moderator Note: Please post code or markup snippets between backticks or use
   the code button.]_
 * THANKS A LOT

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/wordpress-conditional/#post-2819603)
 * Try enqueuing your CSS instead.
    [http://codex.wordpress.org/Function_Reference/wp_enqueue_style](http://codex.wordpress.org/Function_Reference/wp_enqueue_style)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/wordpress-conditional/#post-2819612)
 * possibly combine those two:
    [http://codex.wordpress.org/Conditional_Tags#A_Post_Type](http://codex.wordpress.org/Conditional_Tags#A_Post_Type)
   [http://codex.wordpress.org/Conditional_Tags#A_Single_Page.2C_Single_Post_or_Attachment](http://codex.wordpress.org/Conditional_Tags#A_Single_Page.2C_Single_Post_or_Attachment)
 *  Thread Starter [mattiafrigeri](https://wordpress.org/support/users/mattiafrigeri/)
 * (@mattiafrigeri)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/wordpress-conditional/#post-2819755)
 * Thanks a lot guys! Especially for the quick response.
 * Alchymyth, the second link did the job!
 * `<php if (is_singular('custom-post-type-name')) { ?>`
 * Bye!
 *  [Mukesh Panchal](https://wordpress.org/support/users/mukesh27/)
 * (@mukesh27)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/wordpress-conditional/#post-2819756)
 * [@mattiafrigeri](https://wordpress.org/support/users/mattiafrigeri/)
    this is
   right condition

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WordPress conditional’ is closed to new replies.

## Tags

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

 * 4 replies
 * 4 participants
 * Last reply from: [Mukesh Panchal](https://wordpress.org/support/users/mukesh27/)
 * Last activity: [13 years, 12 months ago](https://wordpress.org/support/topic/wordpress-conditional/#post-2819756)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
