php dynamic stylesheet & wp-blog-header.php
-
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.