Garland 1.2

Ive updated Garland-Revisited.

I had some problems with farbtastic and jquery with wordpress 2.8, after much hair pulling ive ditched farbtastic and the theme uses jscolor.

Please someone try it with 2.8 and let me know if there are any problems, ive tried 2.8 and 2.8.1b2.

here is the link to 1.2 of the theme: HERE

Garland 1.2

Garland…

OK new version is ready just about!
It includes comment numbering with support for Gregs comment numbering plugin, either categories or pages in the header menu and the 404 emails are now configurable.
The 404.php will actually show the users useragent now so you can tell if your getting grief from a spambot or have a genuine link problem.

I’ll be released with 2.8 in a few days!

Garland…

An email from wordpress!

Today I uploaded v1.0.1 of garland-revisited to the wordpress site, a few minutes later i got an email from wordpress.org!

Trying to pull in wp-config.php or wp-load.php directly is a bad idea.  The actual location of those files can be in a nearly infinite number of locations, so trying to reference them directly is guaranteed to break in at least some of the cases.

The code in question is in css.php, the file is requested out of wordpress to provide the custom css, but css.php has to use the wordpress database to find out your custom colours etc..
[php]require( ‘../../../wp-load.php’ );[/php]
The code itself works with a default install of wordpress, but a few people out there might define a different folder for wp-content/themes.. so after som hefty google-fu I found this http://planetozh.com/blog/2008/07/what-plugin-coders-must-know-about-wordpress-26/
[php]$rootPath = dirname(__FILE__);
$rootPathArray = explode("/",$rootPath);
$numDirs = count($rootPathArray);
for ($i=1; $i<=$numDirs; $i++) {
$path = implode("/", $rootPathArray);
if (file_exists($path.’/wp-load.php’)) {
require_once($path.’/wp-load.php’);
break;
} elseif (file_exists($path.’/wp-config.php’)) {
require_once($path.’/wp-config.php’);
break;
}
array_pop($rootPathArray);
}[/php]
This snippet walks back through the dirs until it hits either wp-load or wp-config, I have tested it on a local copy it works fine, so the next version will inlude the fix.

EDIT:
I forgot to follow this post up woth the actual fix from the wordpress guys 😉
css.php is the file i want to call from outside wordpress, but it needs to be wp-config.php loaded first, so the following code is added to the functions.php:
[php]add_filter(‘query_vars’, ‘add_my_var’);
function add_my_var($public_query_vars) {
$public_query_vars[] = ‘garland_css’;
return $public_query_vars;
}
add_action(‘template_redirect’, ‘my_var_output’);
function my_var_output() {
$myvalue=get_query_var(‘garland_css’);
if ($myvalue) {
include(‘css.php’);
exit; // this stops WordPress entirely
}
}[/php]
now i can call the css file from a wordpress url like:
[code]http://myblogurl.com/index.php?garland_css=1[/code]

An email from wordpress!