is_page_template showing partial results

by MauF   Last Updated July 11, 2019 22:08 PM - source

Trying to load conditional content thru the header, but only front page is being identified correctly. Archive, post and custom type templates aren't.

enter image description here

Using Query Monitor to identify correct template and used that template name as argument, with and without child theme folder declaration, but every other template falls into the else conditional.

/* Conditional AD script loading */

/* Front page */
if ( is_home() || is_front_page() ) {
    echo "Front page";
} elseif ( is_page_template(  'single-listing.php' ) ) {
    echo "Listing page template";
} elseif ( is_archive() ) {
    echo "Archive page template";
} elseif ( is_page_template( $template  ='single.php' ) ) {
    echo "Post template";
} else {
    echo "wrong template";


PHP elseif is in header of child theme, template files are within child theme folder too. What am I missing?

Related Questions

how can I remove this part on my website?

Updated December 08, 2017 09:08 AM

How to move header image above the menu bar

Updated July 09, 2016 08:03 AM

Customize header in Enfold theme

Updated February 01, 2017 14:03 PM