Title: is_category() if else statement
Last modified: August 20, 2016

---

# is_category() if else statement

 *  [rhoi](https://wordpress.org/support/users/rhoi/)
 * (@rhoi)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/is_category-if-else-statement/)
 * hi, im noobs in programming and i have a problem in categories
 * i have a lot of categories, but category = 16 or freebies have subcategories.
   if you call the category 16 and its subcategory it will change the navigation
   of the page.
 * here’s my current code
 *     ```
       <?php	if ( is_category('16') || is_category(array( '15', '11', '13', '10', '12', '14' )) ) {
       ?>
   
       <ul>
       <li>sub category of 16</li>
       <li>sub category of 16</li>
       <li>sub category of 16</li>
       </ul>
       <?php	} else { ?>
   
       <ul>
       <li>all categories except freebies and its subcategory</li>
       <li>all categories except freebies and its subcategory</li>
       <li>all categories except freebies and its subcategory</li>
       </ul>
       <?php }?>
       ```
   
 * This code works fine for me in this URL
    1. example/category/freebies/ 2. example/
   category/freebies/subcategory
 * NOW WORK in this URL
    1. example/freebies/subcategory/post-title/ 2. example/
   category/freebies/page/2/
 * i know there’s missing in my if else statement and i dunno if the problem is 
   in the child or parent something…
 * sorry in my poor english.

The topic ‘is_category() if else statement’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [child](https://wordpress.org/support/topic-tag/child/)
 * [if else](https://wordpress.org/support/topic-tag/if-else/)
 * [is_category](https://wordpress.org/support/topic-tag/is_category/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [subcategory](https://wordpress.org/support/topic-tag/subcategory/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [rhoi](https://wordpress.org/support/users/rhoi/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/is_category-if-else-statement/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
