VirtualGilad
Member
Posted 3 years ago #
Greetings!
I have a block of code that looks like this:
<?php
if (is_page()) {
echo 'Something for Pages';
} else {
echo 'Something for Posts';
}
?>
Unexpectedly, the 'Something for Posts' shows on Pages as well as Posts.
What am I doing wrong?
Apologies for the lack of links - These experiments (my first WP sites, really) only exist on my dev box for now...
TIA!
Gilad
cafefrenzy
Member
Posted 3 years ago #
Gilad, I tested your code on one of my page templates in WP 2.7 and it worked perfectly. The 'Something for Posts' did not show up.
VirtualGilad
Member
Posted 3 years ago #
Thanks for the quick assist!
I'm still on 2.6 on this particular site. I wonder if this is only supposed to work in 2.7... Or if there is something else I have breaking me...
I'll upgrade to 2.7 tonight and report back to this thread.
Thanks again!
Gilad
VirtualGilad
Member
Posted 3 years ago #
Well, the upgrade had to be postponed, and then I forgot I owed a response to this thread... Silly me...
Anyway - Once I upgraded to 2.7, the code behaved as expected.
Thanks for the hint, cafefrenzy!
Gilad