I have a script that's called from my functions.php file (via an ajax .get) that needs to have access to WP's get_option() method in order to retrieve some values it needs to process.
However, although the file works great in the majority of sites where it resides, on just a few installations, I'm having problems with the script operating (chrome's javascript console reports a 404 (not found) on color.php.
//jQuery calls the file color.php
$('#my_theme_switcher').change
(
function()
{
$.get
('<?php echo get_bloginfo('template_directory') ?>/color.php',
{theme: 'test', spot: '1'},
function(data)
{
doColor('#theme_header_color', data);
}
);
}
);
Here is the file color.php
<?php
require_once('../../../wp-blog-header.php');
echo 'all good';
?>
In this case, I never get the echo since it appears that the require statement has failed to load the wp-blog-header.php
Is there an alternative way of including the header file in order to be able to call get_option()?