Hi I've been trying to write a query that finds the current blog path and assigns it to a variable for a subdirectory install.
Any help with this would be much appreciated.
Hi I've been trying to write a query that finds the current blog path and assigns it to a variable for a subdirectory install.
Any help with this would be much appreciated.
Current blog path... like how, and from where exactly?
While on a specific page, or something like that?
Need more info, although you could look into the output of the current_site global variable.
Thank you for your reply Lunabyte. I was using this query in a template.
I managed to figure it out although there may be a better way:
<?php
global $wpdb;
$currenblogid = $wpdb->blogid;
$blogpath = $wpdb->get_var( "SELECT path FROM $wpdb->blogs WHERE blog_id = '.$currentblogid.'" );
?>
I was using this for the folder installation version of mu wordpress. This basically gets the folder name.
So for a site like so:
$blogpath will return /blog1/
There is a better way. Like I said, check out the current_site global.
Lots of data already available for ya, without more queries.
Thanks I'll check it out.