Title: php dynamic stylesheet &amp; wp-blog-header.php
Last modified: August 20, 2016

---

# php dynamic stylesheet & wp-blog-header.php

 *  [grosbouff](https://wordpress.org/support/users/grosbouff/)
 * (@grosbouff)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/php-dynamic-stylesheet-wp-blog-headerphp/)
 * I, I would like to have a dynamic stylesheet (php) which loads different css 
   files depending of certain conditions.
 * `wp_enqueue_style( 'yclads-css', yclads_get_theme_file_url('style.php') );`
 * in my style.php :
 *     ```
       <?php
       require('../../../../wp-blog-header.php');
       header('Content-type: text/css');
   
       ?>
       body{
       	background-color:#000;
       }
       @import url('_inc/css/shared.css');
   
       <?php if(!defined('BP_VERSION')){//load styles for WP ?>
       @import url('_inc/css/screen-wp.css');
       <?php }else{ //load styles for BP ?>
       @import url('_inc/css/screen-bp.css');
       <?php
       }
       ?>
       ```
   
 * I need to load wp-blog-header.php to access the WP functions.
    But with this 
   line, the css is broken : here, the body background will not be black. If I comment
   the line, it is black. When I open the source file from firebug; the output seems
   ok :
 *     ```
       body{
       	background-color:#000;
       }
       @import url('_inc/css/shared.css');
   
       @import url('_inc/css/screen-bp.css');
       ```
   
 * Any idea ?

The topic ‘php dynamic stylesheet & wp-blog-header.php’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [grosbouff](https://wordpress.org/support/users/grosbouff/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/php-dynamic-stylesheet-wp-blog-headerphp/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
