You know that you can target single-view pages with the conditional tag, is_single():
<?php
if(is_single()) {
// do something
} else {
// do something else
}
?>
This is a great way to conditionally apply styles, scripts, and markup to single-view pages.
But did you know about the conditional tag, is_singular()? The is_singular() tag enables you to target single-view pages, regular page pages, and attachment pages all in one fell swoop.
So, instead of writing something like this:
<?php
if(is_single() || is_page() || is_attachment()) {
// do something
} else {
// do something else
}
?>
We can write this instead:
<?php
if(is_singular()) {
// do something
} else {
// do something else
}
?>
The is_singular() tag is what’s known as a “boolean” function, meaning that it returns one of two values, either TRUE or FALSE. No parameters are associated with this tag.
Now you know :)
![[ Digging into WordPress ]](http://digwp.com/wp-content/themes/DiggingIntoWordPress-2/images/sidebarbook.png)



In the words of Keanu Reeves: Whoa!.
Handy tip, always good to save some extra typing!
I prefer to use
(is_single() || is_page() || is_attachment())cause it’s more readable. But, these little tips are the difference between a pro or a starter guy. Thanks for the tip!