How to detect single.php (but not single-portfolio.php)?

You can use the following instead,

if (is_singular('post')) {

    //your code here...

}

Where by is_singular is the WordPress API conditional function for testing for the existence of a post type. You can also pass an array of post types if you wish.

http://codex.wordpress.org/Function_Reference/is_singular

Leave a Comment