WPMU Functions/get current site

来自WordPress中文文档
跳转至: 导航搜索

Description

Returns an object containing various information relating to the current network.

Note: get_current_site() was inherited from MU, and is named based on the old terminology which spoke of multiple "blogs" on a "site". We now speak of multiple "sites" on a "network" instead, but some of the old terminology still lives on in some function names. This function returns information about the current network. To get information about the current site on the network, see get_current_blog_id() and get_blog_details().

Usage

%%%<?php get_current_site(); ?>%%%

Parameters

None.

Return Values

(object) 
An object containing details of the site currently being viewed. Details are represented in the following public variables:
id 
(integer) ID of the site currently being viewed.
domain 
(string) Domain of the site currently being viewed.
path 
(string) Path of the site currently being viewed.
site_name 
(string) Title of the site currently being viewed.

Examples

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

Source File

get_current_site() is located in onlyincludecodewp-includes/ms-functions.php/code/onlyinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Template Description

Link to the source code on http://core.trac.wordpress.org/browser/.

Parameters

  1. filename
  2. (option) path to codetag/code (version) or codetrunk/code. This option is only used for a new function.br /Default: codetrunk/code -- trunk is the latest bleeding edge development version of WordPress.

Usage

Link to the stable version: pre检查到模板循环:模板:Trac/pre

Link to trunk: pre检查到模板循环:模板:Trac/pre

/div

wordpress.org.cn.



includeonlydiv style=clear:both; background-color:#FAEBD7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;This page is marked as incomplete. You can help Codex by expanding it./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude