single.php – conditional statements not working
-
Hi,
I’m using wordpress as a basic CMS for a friend, have most things working ok except for the page single.php:
It displays posts ok, but i’m also trying to set-up a menu for each category and i want it to show on the single post page.
Is there a way to display different code depending on what category the post belongs to? I would have thought so but the following doesnt work – it always returns “this is not a recipe page” even when viewing a post that is from category 5.
‘<?php
if (is_single(5)) {
echo’ this is a recipe page’;
} else {
echo’ this IS NOT a recipe page’;
}i have tried ‘5’, the category slug: ‘recipes’ the subcategory numbers etc. nothing seems to work..
any help?
am i missing something really basic (thats my guess!)
?>’
The topic ‘single.php – conditional statements not working’ is closed to new replies.