WPMU Functions/get blog option

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

includeonlydiv style=clear:both; background-color:#FCECAD; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;This article has been requested to be merged into Function_Reference/get_blog_option./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

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

Result

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

/noinclude

Description

Returns data relating to a specific blog.

Parameters

tt$blog_id/tt
(integer) (required) ID of blog queried.
Default: Nonenoinclude

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

Notes

This template is for standardizing how parameters look in the Function Reference and in Template Tags. Here is an example of this template being called: prenowiki检查到模板循环:模板:Parameter/nowiki/pre 检查到模板循环:模板:Parameter

The usage of this template is below: prenowiki检查到模板循环:模板:Parameter/nowiki/pre Let's take a closer look at the parameters..

name
The name of the parameter.
datatype
The datatype that should be given for this parameter when called.
  • string
  • integer
  • boolean
  • mixed
description
A short description of the parameter.
importance
Set this parameter to optional if the parameter is optional. Otherwise, do not declare this parameter—it defaults to required.
  • required
  • optional
default
If this parameter is optional, ttdefault/tt is the value that will be used if the parameter is not declared.

wordpress.org.cn /div /noinclude

tt$setting/tt
(string) (required) Name of setting to fetch.
Default: Nonenoinclude

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

Notes

This template is for standardizing how parameters look in the Function Reference and in Template Tags. Here is an example of this template being called: prenowiki检查到模板循环:模板:Parameter/nowiki/pre 检查到模板循环:模板:Parameter

The usage of this template is below: prenowiki检查到模板循环:模板:Parameter/nowiki/pre Let's take a closer look at the parameters..

name
The name of the parameter.
datatype
The datatype that should be given for this parameter when called.
  • string
  • integer
  • boolean
  • mixed
description
A short description of the parameter.
importance
Set this parameter to optional if the parameter is optional. Otherwise, do not declare this parameter—it defaults to required.
  • required
  • optional
default
If this parameter is optional, ttdefault/tt is the value that will be used if the parameter is not declared.

wordpress.org.cn /div /noinclude

tt$default/tt
(integer) (optional) Deprecated.
Default: falsenoinclude

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

Notes

This template is for standardizing how parameters look in the Function Reference and in Template Tags. Here is an example of this template being called: prenowiki检查到模板循环:模板:Parameter/nowiki/pre 检查到模板循环:模板:Parameter

The usage of this template is below: prenowiki检查到模板循环:模板:Parameter/nowiki/pre Let's take a closer look at the parameters..

name
The name of the parameter.
datatype
The datatype that should be given for this parameter when called.
  • string
  • integer
  • boolean
  • mixed
description
A short description of the parameter.
importance
Set this parameter to optional if the parameter is optional. Otherwise, do not declare this parameter—it defaults to required.
  • required
  • optional
default
If this parameter is optional, ttdefault/tt is the value that will be used if the parameter is not declared.

wordpress.org.cn /div /noinclude

Options

Any settings in the wp_(blog_id)_options table can be fetched using this function including:

siteurl 
Full URL of the blog queried (eg. http://www.example.com/blog).
blogname 
Name of the blog queried.
blogdescription 
Description of the blog queried.
wp_#_user_roles 
Roles available in this blog (where # is the ID of the blog being queried).
users_can_register 
Flag indicating if users can register on the queried blog.
admin_email 
Email address of the admin user of the blog queried.
start_of_week 
Day of the week set as the week start for the blog queried.
use_balanceTags 
Flag indicating if the queried blog uses balanced tags.
use_smilies 
Flag indicating if the queried blog converts text smilies to images.
require_name_email 
Flag indicating if the queried blog requires names and emails in posted comments.
comments_notify 
Flag indicating if the queried blog notifies the admin user when a new comment is posted.
posts_per_rss 
Number of posts carried in the queried blog's RSS feed.
rss_excerpt_length 
Length of excerpt carried in the queried blog's RSS feed.
rss_use_excerpt 
Flag indicating if the queried blog's RSS feed carries a post's excerpt.
mailserver_url 
URL of mail server used when sending email from the queried blog.
mailserver_login 
Username used with the above mail server.
mailserver_pass 
Password used with the above username and mail server.
mailserver_port 
Port used with the above mail server.
default_category 
ID of category in which blog posts are published by default.
default_comment_status 
Status comments are set to when posted by default.
default_ping_status 
Ping status set by default when new blog posts are published.
default_pingback_flag 
Flag indicating the default status of pingbacks when new blog posts are published.
default_post_edit_rows 
Default size of the post edit box.
posts_per_page 
Number of posts displayed per page on the bog queried.
what_to_show 
[unknown]
date_format 
Format in which dates are disaplyed on the blog queried.
time_format 
Format in which times are displayed on the blog queried.
links_updated_date_format 
[unknown]
links_recently_updated_append 
[unknown]

Return Values

(mixed) 
The value of the setting requested.

Usage

%%%<?php get_blog_option($blog_id, $setting, $default); ?>%%%

Examples

%%%<?php $blog_id = 1; echo 'Blog '.$blog_id.' is called '.get_blog_option( $blog_id, 'blogname' ); ?>%%%

Notes

Pulls the provided information from the wp_#_options table.