Care to post some code? As given, there’s no reason for it to behave as you say. Stick something up on http://pastebin.com or something.
Thread Starter
ult
(@ult)
<?php if ( (is_home()) || (is_archive()) ) { ?>
– works
<?php } ?>
<?php if (is_home()) { ?>
– works only first time
<?php } ?>
I know, it’s weird… 🙂
Perhaps someting in php code in between…
The code is placed in sidebar.php.
How do you mean “works only first time”? Do you mean if you refresh the page it doesn’t work? or if you return to the homepage it doesn’t work on the second visit. (Is it a browser cache issue? F5?)
I’ve just checked this code in my site
<?php if (is_home()) { ?>
and it works fine. A block on my sidebar now only appears on the home page.
What I did discover, however, is that if I had something (X)HTML-commented-out either before or after it, eg
<?php if (is_home()) { ?>
<!-- <?php /* If this is the home page */ if ( (is_home()) or (is_page('contact')) ) { ?> -->
then I’d get an error and in the spirit of Gandalf: None shall pass!
Gareth
Thread Starter
ult
(@ult)
Thanks,
The problem was similar, a php comment, something like <?php … { /* ?> in the middle of the page, and after that is_home() didn’t work anymore 🙂