Title: single.php &#8211; conditional statements not working
Last modified: August 19, 2016

---

# single.php – conditional statements not working

 *  [modelcitizen](https://wordpress.org/support/users/modelcitizen/)
 * (@modelcitizen)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/singlephp-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!)
 * ?>’

Viewing 1 replies (of 1 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/singlephp-conditional-statements-not-working/#post-794244)
 * Wouldn’t you use [is_category(‘5’)](http://codex.wordpress.org/Conditional_Tags#A_Category_Page)?

Viewing 1 replies (of 1 total)

The topic ‘single.php – conditional statements not working’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [17 years, 12 months ago](https://wordpress.org/support/topic/singlephp-conditional-statements-not-working/#post-794244)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
