Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress dynamic CSS with wp-load

Tags:

css

php

wordpress

I have a dynamic css file that pulls information from the database e.g

header("Content-type: text/css");

require_once('../../../../wp-load.php');

if ( get_option(PREFIX."_theme_base_color") <> "" ){
    $default_theme_colour = html_entity_decode(get_option(PREFIX."_theme_base_color"),ENT_QUOTES, "UTF-8"); 
} else {
    $default_theme_colour = 'a3f088';
};

but I really hate using require_once('../../../../wp-load.php'); and there has to be a better way to loat "wp-load" into the file.

like image 377
Ryan Potter Avatar asked Mar 31 '26 07:03

Ryan Potter


1 Answers

it seems that you are using some kind of plugin , or theme with plugin codes.

If you are the developer , you can read here :

http://ottopress.com/2010/dont-include-wp-load-please/

At any case ,you can use bloginfo('wpurl'); or is you have set a BASENAME than **plugin_basename($file); **

if you are a simple user ,I suggest you leave that as it is .

like image 78
krembo99 Avatar answered Apr 02 '26 20:04

krembo99



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!