3

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.

1 Answer 1

1

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 .

Sign up to request clarification or add additional context in comments.

2 Comments

Hi, thanks for the reply. This is for my own theme, I don't really want to write up my css in the functions.php file. In regards to the bloginfo('wpurl') I would still have to hard code the path echo get_bloginfo("wpurl").'/wp-content/wp-load.php'; Perhaps I'm just being pedantic.
well, my friend, There is nothing wrong being edantic when writing code . I know I am . :-) but IMHO - you do not have a choice . SOMEWHERE it needs to be defined. the shortest way I can think is this : site_url( 'wp-load.php' ) but I would recommend you to read the link I have posted, along with other info (google) on why it is not o good to include it .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.