Title: &#8220;if&#8221; question
Last modified: August 18, 2016

---

# “if” question

 *  [funtimeben](https://wordpress.org/support/users/funtimeben/)
 * (@funtimeben)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/if-question/)
 * I am trying to set up an if statement that tags on a bit of code if selected 
   document is part of a given category, but I want it only to function on single
   pages or categories.
 * So far I have
 *  <?php if ((in_category(‘1’))):Â ?> current_page_item<?php endif;Â ?>
 * how would I exclude the home page from matching this script?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/if-question/#post-148317)
 * `if( in_category( '1' ) && !is_home() )`
 *  Thread Starter [funtimeben](https://wordpress.org/support/users/funtimeben/)
 * (@funtimeben)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/if-question/#post-148318)
 * You rock too hard!
 * You can have my first born

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘“if” question’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [funtimeben](https://wordpress.org/support/users/funtimeben/)
 * Last activity: [21 years, 1 month ago](https://wordpress.org/support/topic/if-question/#post-148318)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
