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

Dion Hulse (dd32) wordpress at dd32.id.au
Tue Sep 15 10:19:18 UTC 2009


That still loads WordPress Twice for every  request, And doesnt work for a  
custom WP_CONTENT_DIR

Best method is a normal Style.css file, and:
add_action('wp_head', 'custom_css');
function custom_css() {
echo '<style>';
echo '.textColor1 { color:' . get_option('theme_colour1') . '; }';
echo '.textColor2 { color:' . get_option('theme_colour2') . '; }';
....
echo '</style>';
}

Remember, that you can have multiple .class's , ie.
style.css:
.textColor1 {
font-weight: bold;
}

and the above code, End result is that you get bolded coloured text.

The Monotone theme is the first theme which comes to mind which shows that  
system in use.


On Tue, 15 Sep 2009 18:58:48 +1000, Jörn Röder <kontakt at joernroeder.de>  
wrote:

> Hi,
> I think, you can…
>
> i try this:
> - create style.css.php
>
> -embed new styles
> - style.css:
> 	@import url(style.css.php);
>
> - style.css.php:
>
> <?php
> require_once("../../../wp-blog-header.php");
> header("Content-type: text/css");
> ?>
> @charset '<?php bloginfo('charset') ?>';
>
> #header:after,
> .header:after {
> 	content:'<?php bloginfo('name'); ?>'
> }
>
> I don't now if there are any problems with caching, but you can read
> this article on smashingmagazine about php and css. Maybee it will
> help you.
> http://www.smashingmagazine.com/2009/09/10/css-wishlist-new-ideas-debates-and-solutions/
>
>
>
> Am 15.09.2009 um 08:13 schrieb Andrew Ozz:
>
>> Stephen Rider wrote:
>>> Okay then, here's an example that probably comes up a lot in plugins.
>>> I want to make a CSS file that gets some of its stuff from PHP.  So
>>> "mystyles.css.php".  Most of it is a simple echo, but a few things
>>> in the stylesheet are pulled from settings on the wp_settings table
>>> in the database.
>>> The CSS/PHP file is pulled directly by the browser and is thus not
>>> "WP Aware".  How would I get that file to access the WP database?
>>
>> Short answer: you can't. Best option is to add a normal stylesheet
>> and then output any bits that depend on the db in a <style> tag
>> after that. This way WordPress won't run twice on each page load
>> (once to generate the HTML, second time to generate the stylesheet).
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


-- 
--
Dion Hulse
e: contact at dd32.id.au
w: http://dd32.id.au/
m: 04 6621 9112 (+614 6621 9112)
WordPressQI: http://wordpressqi.com/


More information about the wp-hackers mailing list