Title: Conditional Function To Enqueue Stylesheet
Last modified: August 22, 2016

---

# Conditional Function To Enqueue Stylesheet

 *  [mrcangrejero](https://wordpress.org/support/users/mrcangrejero/)
 * (@mrcangrejero)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/conditional-function-to-enqueue-stylesheet/)
 * I have a parent theme and a child theme, both with their own style.css file.
 * My functions.php file has the following:
 *     ```
       function theme_styles() {
       	wp_enqueue_style( 'parent_bootstrap_css', get_template_directory_uri() . '/css/bootstrap.css' );
       	wp_enqueue_style( 'parent_style_css', get_template_directory_uri() . '/style.css' );
       }
       add_action( 'wp_enqueue_scripts', 'theme_styles' );
       ```
   
 * When using my child theme, I would like to modify the function to conditionally
   enqueue the child’s style.css when template_directory and stylesheet_directory
   are not the same.
    Any help appreciated. Thanks!!!

The topic ‘Conditional Function To Enqueue Stylesheet’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [enqueue](https://wordpress.org/support/topic-tag/enqueue/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [Stylesheet](https://wordpress.org/support/topic-tag/stylesheet/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [mrcangrejero](https://wordpress.org/support/users/mrcangrejero/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/conditional-function-to-enqueue-stylesheet/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
