squidpeg
Member
Posted 8 months ago #
I have a header callout area for an opt-in form on my site, but I need it to appear above every page EXCEPT the home page. How can I set the home page to not have this opt-in area without manually going in and adding the code to each and every page I DO want it on?
The site is claritymind.com, but I have taken the opt-in area down for now as it isn't doing what I want.
Thanks!
What you want to do is use a conditional statement in the header area.
So something like:
<?php if(is_front_page()) {?>
Do this....
<?php } else { ?>
Do that
<?php } ?>
squidpeg
Member
Posted 8 months ago #
Thank you for a quick response! I am very very new to PHP, so is it possible to have something like
<?php if(is_front_page()) {?>
Do Nothing!
<?php } else { ?>
Do that...
<?php } ?>
The home page is exactly the way I want, so I don't want anything to happen on it. I just need the opt-in to show at the top of all the other pages.
squidpeg
Member
Posted 8 months ago #
Just answered my own question with this:
<?php if(is_front_page()) {?>
<?php } else { ?>
(opt-in code)
<?php } ?>
Thanks so much!
Indeed that would work.
Another option is:
<?php if(!is_front_page()) {?>
(opt-in code)
<?php } ?>
The exclamation mark means if this is NOT the home page, then insert the opt-in code.