“WPMU Functions/get current site”的版本间的差异

来自WordPress中文文档
跳转至: 导航搜索
 
(General elaboration and tidying.)
第1行: 第1行:
{{Stub}}
+
== Description ==
  
The function as found in footer.php of most Wordpress themes:
+
Returns an object containing various information relating to the blog currently being viewed.
  
<?php $current_site = get_current_site(); ?>
+
== Parameters ==
  
 +
None.
  
Need content to help solve the following PHP fatal error:
+
== Return Values ==
  
Fatal error: Call to undefined function get_current_site() in /blah/www.mysite.com/wp-content/themes/blah/footer.php on line 2
+
An object containing details of the blog currently being viewed.  Details are represented in the following public variables:
 +
; id : ''(integer)'' ID of the blog currently being viewed.
 +
; domain : ''(string)'' Domain of the blog currently being viewed.
 +
; path : ''(string)'' Path of the blog currently being viewed.
 +
; site_name : ''(string)'' Title of the blog currently being viewed.
 +
 
 +
== Usage ==
 +
 
 +
%%%?php get_current_site(); ?%%%
 +
 
 +
== Examples ==
 +
 
 +
%%%?php
 +
$current_site = get_current_site();
 +
echo 'You are viewing '.$current_site-site_name;
 +
?%%%
 +
%%%?php
 +
echo 'You are viewing '.get_current_site()-site_name;
 +
?%%%
 +
 
 +
----
  
 
[[Category:WPMU]]
 
[[Category:WPMU]]

2009年3月5日 (四) 15:47的版本

Description

Returns an object containing various information relating to the blog currently being viewed.

Parameters

None.

Return Values

An object containing details of the blog currently being viewed. Details are represented in the following public variables:

id 
(integer) ID of the blog currently being viewed.
domain 
(string) Domain of the blog currently being viewed.
path 
(string) Path of the blog currently being viewed.
site_name 
(string) Title of the blog currently being viewed.

Usage

%%%?php get_current_site(); ?%%%

Examples

%%%?php $current_site = get_current_site(); echo 'You are viewing '.$current_site-site_name; ?%%% %%%?php echo 'You are viewing '.get_current_site()-site_name; ?%%%