For my site, I need to have different header colors depending on the page it's on. Here's the code I have for my site that is working:
<?php if ( is_single() && is_post_type('product') || is_page(576) || is_single() && is_post_type('post')) : ?>
<div class="header-inner">
<style type="text/css">.header-inner { background-color:#861919!important; }</style>
<?php else : ?>
<div class="header-inner" style="background-color:rgba(0,0,0,0.30);">
<?php endif; ?>
I am trying to modify the above to exclude certain product posts due to their design. I will note that most products use post-template.php, and the ones I need to have a transparent header are using product-specialty.php. My developer installed the plugin WP Post to be able to select the different templates. Here's my attempt at the modified code but it's resulting in nothing loading:
<?php if ( is_single(893,892,843,895,894,896) ) : ?>
<div class="header-inner" style="background-color:rgba(0,0,0,0.30);">
<?php else( is_single() && is_post_type('product') || is_page(576) || is_single() && is_post_type('post')) : ?>
<div class="header-inner">
<style type="text/css">.header-inner { background-color:#861919!important; }</style>
<?php elseif : ?>
<div class="header-inner" style="background-color:rgba(0,0,0,0.30);">
<?php endif; ?>
Any idea what I'm doing wrong there?
body_class
function correctly, the body tag will have a css class with the page ID you can select against, and you get to avoid the inline style tags too