Well, I’ve been working on updating the WP People hack to a WP 2.0 plugin.
So, in the plugin part was easy, sort of
That got me the root and then I just went up from there, since everyone who uses 2.0 has to use the correct file structure. The next problem after that was putting it into the header. After searching through the codex stuff, I finally figure out how to do that.
$blogSiteURL = get_option('siteurl');
echo "<link rel=\"stylesheet\" href=\"" . $blogSiteURL . "/wp-content/plugins/wp-people/ibox.css\" type=\"text/css\" media=\"screen\" />";
In the popup file, I had to be a little more creative. Since the popup file isn’t part of the blog structure, I can’t use the function to determine where the site root was.
$uriPieces = explode("/",$_SERVER['PHP_SELF']);
$key = array_search('wp-content', $uriPieces);
$blogRoot = "/wp-blog-header.php";
if($key > 0)
$blogRoot = "/" . $uriPieces[$key - 1] . $blogRoot;
require($_SERVER['DOCUMENT_ROOT'] . $blogRoot);
So, I found the current location of the page, split it up into an array, and then checked to see where the “wp-content” file was. From there, I just went down one level to get the blog root.
var thisDomain = document.domain;
This gives me the document domain and from there I get the image directory.