[wp-hackers] wp-config.php, wp-load.php, and ABSPATH

scribu scribu at gmail.com
Tue Sep 15 16:36:52 UTC 2009


On 9/15/09, Ozh <ozh at planetozh.com> wrote:
>> Soo... either do the "wrong" thing by not using enqueue, or do the
>> "wrong" thing by direct-loading wp-config.php.   I don't personally
>> see any harm in bypassing enqueue in such cases, but there are some
>> seriously mixed signals going on....  :-\
>
> There's another half baked solution
>
> Instead of including wp-config.php in your custom.css.php and fire WP a
> second time, you can simply pass a number of parameters you need in your
> CSS
>
> Something like
> $options = get_option('my_plugin');
> $color1 = $options['color1'];
> $color2 = $options['color2'];
> $width = $options['width'];
> wp_enqueue_script('my_plugin',
> $path."/custom.css.php?color1=$color1&etc..");
>
> Depending on how many variables the custom CSS needs to know this can be
> easier to do
>
> Ozh
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>

Interesting solution. It sort of solves the two wrongs: using
wp_enquee and not loading WP twice.

But then again, I don't think it has any performance advantage over
just putting the CSS in the head. I guess it depends on how dynamic it
is.

So, Steven, guidelines are meant to be ignored sometimes, imo. :-)

-- 
http://scribu.net


More information about the wp-hackers mailing list