[wp-hackers] Dynamic Style Sheets

Guy Leech guyleech at gmail.com
Sun Apr 29 06:32:20 GMT 2007


Interesting, though I don't understand why you're defining 'WP_USE_THEMES'
as false. Care to enlighten me?

My solution is to send out a '<?php header('Content-Type: text/css'); ?>' at
the very end of the file. I've only tested it in current browsers, but I see
no obvious reason why it wouldn't work. It looks something like this:

--
/* CSS stuff */
<?php //PHP stuff ?>
/*CSS stuff */
<?php header('Content-Type: text/css'); ?>
--

- Guy

On 4/29/07, chris burgess <chris at giantrobot.co.nz> wrote:
>
> Not exactly what you're asking, but ...
>
> I used a php-generated JS file to do this for another site. I had to add
> the Status header manually for at least one version of WP2.
>
> There may be a "more correct" way to do this, one which doesn't involve
> overwriting the 404 header that appear(s|ed) if WP doesn't recognise
> your direct reference of teh CSS/JS file.
>
> --
> <?
>   define('WP_USE_THEMES', false) ;
>   require('../../../wp-blog-header.php');
>   header("HTTP/1.1 200 OK");
>   header("Status: 200 All rosy") ;
> ?>
>
> /**
> * javascript or css here
> */
> --
>
> this way you can reference the CSS/JS and it will work.
>
> I'd love to hear a more "proper" way to embed WP functions without
> activating the request handler. I couldn't find it at the time.
>
> if WP sets a 404 header on a JS or CSS file, then only some browsers
> will parse it (guess who), while others will ignore it unless it has a
> 200 or other goody.
>


More information about the wp-hackers mailing list