マルチサイトブログの情報の表示

head line

ブログの数やユーザ数を調べる

表示例

There are currently 2 sites running on this network and 3 users.

<?php
$stats= get_sitestats();
echo 'There are currently '.$stats[ 'blogs' ].' sites running on this network and '.$stats[ 'users' ].' users.';
?>

すべてのブログの情報

<?php
$blog_list= get_blog_list( 0, 'all' );

foreach ($blog_list AS $blog) {
echo 'Blog '.$blog['blog_id'].': '.$blog['domain'].$blog['path'].'<br />';

}
?>
array(2) {
 [0]=>
 array(4) {
 ["blog_id"]=>
 string(1) "2"
 ["domain"]=>
 string(15) "www.tenman.info"
 ["path"]=>
 string(15) "/wp3/subdomain/"
 ["postcount"]=>
 string(2) "16"
 }
 [1]=>
 array(4) {
 ["blog_id"]=>
 string(1) "1"
 ["domain"]=>
 string(15) "www.tenman.info"
 ["path"]=>
 string(5) "/wp3/"
 ["postcount"]=>
 string(2) "14"
 }
}

現在のブログ名を調べる

<?php
global $blog_id;
$my_name=get_blog_details($blog_id);

echo $my_name->blogname;
?>

ステータスの取得

<?php
global $blog_id;
/**
 * 
 *
 * Usage
 *
 * <?php get_blog_status($id, $pref); ?>
 *
 * blog_id 
 * ID of the blog queried.
 * site_id 
 * ID of the site this blog belongs to (as wp_site).
 * domain 
 * Domain used to access this blog.
 * path 
 * Path used to access this site.
 * registered 
 * Date and time this blog was registered.
 * last_updated 
 * Date and time this blog was last updated.
 * public 
 * Flag indicating if this blog is public or not.
 * archived 
 * Flag indicating if this blog has is archived or not.
 * mature 
 * Flag indicating if this blog has been marked as for a mature audience.
 * spam 
 * Flag indicating if this blog has been marked as spam.
 * deleted 
 * Flag indicating if this blog has been marked as deleted.
 * lang_id 
 * ID of the language this blog is written in.
 */

[emulsion_relate_posts]