The short answer would be to try and use is_archive()
instead of is_category()
. If that doesn't work, you may need to dump your global $wp_query
variable and see what query types are being returned on that particular url.
In that same vein, you may consider using is_singular()
instead of is_single()
, because is_single
is limited to Posts.
One more point to consider is using &&
instead of AND
(they're synonymous other than precedence. Take a look at this answer for a bit more in-depth on it)
Lastly, if you're only loading in a separate Google Ad Manager code, I'm not sure you need to maintain x
number of header files. Have you considered dropping in the script codes into your functions.php
file and loading them on the wp_enqueue_scripts
or wp_head
hooks?
instead of maintaining separate headers like this:
if( is_front_page() ){
get_header( 'home' );
} else if( is_page() ){
get_header( 'page' );
} else if( is_singular() ){
get_header( 'article' );
} else if( is_archive() ){
get_header( 'category' );
} else {
get_header();
}
You could drop those scripts straight in based on the same is_
functions using something like this:
add_action( 'wp_head', 'load_ad_manager_scripts' );
function load_ad_manager_scripts(){
if( is_front_page() ){
echo '<script>// Home Ad Manage Code</script>';
} else if( is_page() ){
echo '<script>// Page Ad Manage Code</script>';
} else if( is_singular() ){
echo '<script>// Single Manage Code</script>';
} else if( is_archive() ){
echo '<script>// Archive Manage Code</script>';
} else {
echo '<script>// Generic Manage Code</script>';
}
}