When I’m using is_single();
in my <head>
section to add some style to website navigation it executes correctly on blog posts but it also executes on single “portfolio” post type posts (so single-portfolio.php and single.php).
How do I make it execute only on single.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