Title: is_single problem!
Last modified: August 20, 2016

---

# is_single problem!

 *  Resolved [gxt](https://wordpress.org/support/users/gxt/)
 * (@gxt)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/is_single-problem/)
 * Hi,
    I’m having problems with is_single()
 * The problem is that is_single() is supposed to work only on posts, NO “pages”
   and “attachments”, if I understand it right. Because if not there will be no 
   difference between is_single and is_singular
 * >  is_single() returns true if any single post is being displayed
   >  is_singular()
   > returns true when any page, attachment, or single post is being displayed.
 * But If I try to include a file only into a POST
 *     ```
       <?php if ( is_single() ) { ?>
       	<link rel="stylesheet" href="style.css" />
       <?php } ?>
       ```
   
 * the css file appears also on attachment pages
    **example.com/?attachment=123456789**
   AND THAT AINT SUPPOSED TO HAPPEN.
 * Is there a bug in wordpress or I’m doing something wrong?!!
 * Thank you!

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/is_single-problem/#post-3045324)
 * Are your attachments pointing to POST pages when you insert them?
 *  Thread Starter [gxt](https://wordpress.org/support/users/gxt/)
 * (@gxt)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/is_single-problem/#post-3045328)
 * when I insert images I use
    **[gallery columns="1" size="large"]** then in the**
   post**, images (somename-500×550.jpg) point to the original image (somename.jpg)
   not to the attachment page.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/is_single-problem/#post-3045376)
 * Can we see one of these attachment links & pages?
 *  Thread Starter [gxt](https://wordpress.org/support/users/gxt/)
 * (@gxt)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/is_single-problem/#post-3045389)
 * it’s not online yet. **But problem was solved**
    – 2 ways to exclude attachments
   from POSTS and get a file only and exclusively on POSTS. – 1:
 *     ```
       <?php if ( is_single() && !is_attachment() ) { ?>
           <link rel="stylesheet" href="style.css" />
       <?php } ?>
       ```
   
 * – 2 way:
 *     ```
       <?php if ( is_singular('post') ) { ?>
           <link rel="stylesheet" href="style.css" />
       <?php } ?>
       ```
   
 * I suggest the second way.
 * –
    [Thanks to wordpress.stackexchange for the help](http://wordpress.stackexchange.com/questions/65183/is-single-problem)

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

The topic ‘is_single problem!’ is closed to new replies.

## Tags

 * [attachment](https://wordpress.org/support/topic-tag/attachment/)
 * [is_single](https://wordpress.org/support/topic-tag/is_single/)
 * [is_singular](https://wordpress.org/support/topic-tag/is_singular/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [problem](https://wordpress.org/support/topic-tag/problem/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [gxt](https://wordpress.org/support/users/gxt/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/is_single-problem/#post-3045389)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
