Title: Conditional CSS Stylesheets
Last modified: August 18, 2016

---

# Conditional CSS Stylesheets

 *  Resolved [qnp9999](https://wordpress.org/support/users/qnp9999/)
 * (@qnp9999)
 * [19 years ago](https://wordpress.org/support/topic/conditional-css-stylesheets/)
 * I am working on a way to give multiple categories a style sheet. I know there
   must be a better way… but I am not the best with php.
 * Here is the code I am working with:
 * I thought this might work but apparently id did not.
 *     ```
       <?php if ( is_category ('1' ,'8' , '9' , '10' , '11' , '12' , '13' , '14')) { ?>
       <link rel="stylesheet" href="<?php bloginfo('url'); ?>/wp-content/themes/wrastle-10/threads.css" type="text/css" media="screen" />
       <?php } ?>
       ```
   
 * So I have fallen back on the oh so un-elegant.
 *     ```
       <?php if ( is_category ('1')) { ?>
       <link rel="stylesheet" href="<?php bloginfo('url'); ?>/wp-content/themes/wrastle-10/custom.css" type="text/css" media="screen" />
       <?php } ?>
       <?php if ( is_category ('8')) { ?>
       <link rel="stylesheet" href="<?php bloginfo('url'); ?>/wp-content/themes/wrastle-10/custom.css" type="text/css" media="screen" />
       <?php } ?>
       ```
   
 * etc. etc.

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

 *  Thread Starter [qnp9999](https://wordpress.org/support/users/qnp9999/)
 * (@qnp9999)
 * [19 years ago](https://wordpress.org/support/topic/conditional-css-stylesheets/#post-547128)
 * Found my own answer!
 *     ```
       <?php if ( is_category('1') || is_category('8') || is_category('9') || is_category('10') || is_category('11')|| is_category('12') || is_category('13')|| is_category('14')) { ?>
       <link rel="stylesheet" href="<?php bloginfo('url'); ?>/wp-content/themes/wrastle-10/threads.css" type="text/css" media="screen" />
       ```
   
 *  [Pizdin Dim](https://wordpress.org/support/users/pizdin_dim/)
 * (@pizdin_dim)
 * [19 years ago](https://wordpress.org/support/topic/conditional-css-stylesheets/#post-547130)
 * The function `is_category()` doesn’t support multiple categories. You can only
   test for either one id or one name, so the way you did it is correct.

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

The topic ‘Conditional CSS Stylesheets’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Pizdin Dim](https://wordpress.org/support/users/pizdin_dim/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/conditional-css-stylesheets/#post-547130)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
