WordPress ignoring is_page() conditional

<?php if( is_home()  || is_page(10)): ?> 
    <div class="text-center col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
<?php elseif(is_single() && !is_page(10)): ?>
    <div class="text-center col-xl-9 col-lg-9 col-md-9 col-xs-12">
<?php endif; ?>

All I’m trying to do is change the classes assigned to this

if you are on a single post, which works fine, but I can’t get it under control when viewing a contact page, which it seems to recognize as a single post. This is fine, but I want to exclude one page from this effect.

I’ve tried is_page(‘Contact’), is_page(‘contact’), and is_page(10)
None of them seem to return true in any case, I even deleted all other conditionals and just had it print something if its the contact page, but it still doesn’t return true and has no effect.

I’ve done a lot of searching and all I can find says I’m using it correctly.. I’m at a loss as to why it wouldn’t return true?

Am I using php if statements incorrectly and it’s been an ‘oops, it worked’ scenario thus far?
The url to the page ends with ?page_id=10, the page is titled ‘Contact’

Read more here: WordPress ignoring is_page() conditional

Leave a Reply

Your email address will not be published. Required fields are marked *