funny switch in the sidebar
-
Can anyone give me a hand, please?
I have this in my right sidebar, quite simple:
<? $why = is_page(); switch($why) { case "about-us": echo "About us"; break; case "latest-news": echo "Latest News"; break; case "our-community": echo "Our community"; break; default: print "DEFAULT"; break; } ?>
Then the pages with that slug are calling or including (neither does work) the same side bar and I would like to display different content on each page.
The switch does work for the about page but not for the other two and I think I am going crazy :). I mean, if you click on the about page it shows what it’s in the echo for that case, but Default for the others.
is_page is supposed to get the slug, right?!
Another curious thing, if I get the about-us case on the second position in the switch, after the latest news, when I click on about-us page I have the echo from latest-news and the rest just on Default! WHY?!
Thank you ??
- The topic ‘funny switch in the sidebar’ is closed to new replies.