Title: is_category(array());
Last modified: August 19, 2016

---

# is_category(array());

 *  Resolved [syncbox](https://wordpress.org/support/users/syncbox/)
 * (@syncbox)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/is_categoryarray/)
 * I have a site that uses
 *     ```
       if is_category(array(x,x,x,x)) {
       include stuff;
       }
       else {
       include something else;
       }
       ```
   
 * more or less.
 * After upgrading to the latest version, I am getting this error for those lines:
   **
   Parse error: syntax error, unexpected T_STRING, expecting ‘(‘ in /path to index
   file of this site
 * where it is referring to the first is_category(array()) line
 * I cannot see that another ( is required in that line per the documentation for
   conditionals… am I wrong?
 * Is there another way to approach this? My if/ifelse/else code is more complex,
   but I am keeping it simple for this example… I’ve simplified it in the page and
   still get that error, so..
 * The actual code:
 *     ```
       <?php
       if is_category(array(9,10,14,15,16,25,27,28,33,67)) {
       include (TEMPLATEPATH . '/branding-chartus.php');
       }
       elseif is_category(array(12,29,34,59)) {
       include (TEMPLATEPATH . '/branding-ondeck.php');
       }
       elseif is_category(array(21,22,23,24,30)) {
       include (TEMPLATEPATH . '/branding-building.php');
       }
       elseif (is_category(34)) {
       include (TEMPLATEPATH . '/branding-captain.php');
       }
       elseif (is_category(44)) {
       include (TEMPLATEPATH . '/branding-crew.php');
       }
       else {
       include (TEMPLATEPATH . '/branding-default.php');
       }
       ?>
       ```
   

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

 *  Thread Starter [syncbox](https://wordpress.org/support/users/syncbox/)
 * (@syncbox)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/is_categoryarray/#post-1070826)
 * OKAY, it’s like I finally ask here and then I figure it out. Oh well… if that
   works, then thanks for the help! 🙂
 * The issue was that it needed (is_category(array(x,x,x,x))) {
 * someone should update the documentation to indicate that like other conditionals,
   the parentheses are required around the is_category part, tool…
 * It says:
 * is_category()
    When any Category archive page is being displayed. is_category(‘
   9’) When the archive page for Category 9 is being displayed. is_category(‘Stinky
   Cheeses’) When the archive page for the Category with Name “Stinky Cheeses” is
   being displayed. is_category(‘blue-cheese’) When the archive page for the Category
   with Category Slug “blue-cheese” is being displayed.
 * I see that farther down, in an example, it’s used correctly. Oddly, this didn’t
   cause any problems in an earlier version of WP, only now after updating to the
   2.7x version.
 *  [advan](https://wordpress.org/support/users/advan/)
 * (@advan)
 * [17 years ago](https://wordpress.org/support/topic/is_categoryarray/#post-1071236)
 * Hi!
    I had same problem, but [in-category](http://codex.wordpress.org/Template_Tags/in_category)
   fixed it. My current code is like that:
 *     ```
       ?php
       if ( in_category('3') ) {
       include 'promo_1.php';
       } elseif ( in_category('4') ) {
       include 'promo_2.php';
       }
       ```
   

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

The topic ‘is_category(array());’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [errors](https://wordpress.org/support/topic-tag/errors/)
 * [is_category](https://wordpress.org/support/topic-tag/is_category/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [advan](https://wordpress.org/support/users/advan/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/is_categoryarray/#post-1071236)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
