[wp-hackers] wp-config.php, wp-load.php, and ABSPATH
admin at laptoptips.ca
Tue Sep 15 06:13:40 UTC 2009
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
> 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).
More information about the wp-hackers