WordPress:WPMU Functions/get current site

来自站长百科
Xxf3325讨论 | 贡献2008年9月26日 (五) 14:25的版本 (新页面: {{Stub}} Returns the following items: id domain path site_name ==Usage== To get the blog id, you would use the following code: $current_site = get_current_site(); echo $curr...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

This page is [[WordPress::Category:Stubs|marked]] as incomplete. You can help Codex by expanding it.

Returns the following items:

 id
 domain
 path
 site_name

Usage

To get the blog id, you would use the following code:

$current_site = get_current_site();
echo $current_site->id;

Or, to do the same, but in only one line:

echo get_current_site()->id;

Other

The function as found in footer.php of most Wordpress themes:

<?php $current_site = get_current_site(); ?>


Need content to help solve the following PHP fatal error:

Fatal error: Call to undefined function get_current_site() in /blah/www.mysite.com/wp-content/themes/blah/footer.php on line 2