WordPress: Function Reference/get option:修订间差异
(新页面: == Description == A safe way of getting values for a named option from the options database table. If the desired option does not exist, '''FALSE''' will be returned. == Usage == %%% <...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
== Description == | == Description == | ||
== 描述== | |||
A safe way of getting values for a named option from the options database table. If the desired option does not exist, '''FALSE''' will be returned. | A safe way of getting values for a named option from the options database table. If the desired option does not exist, '''FALSE''' will be returned. | ||
为选项数据库表格中安全地得到指定的一个选项的参数值。如果没有想要的选项,会返回'''错误的'''。 | |||
== Usage == | |||
== 用法 == | |||
%%% <?php echo get_option('show'); ?> %%% | |||
%%% <?php echo get_option('show'); ?> %%% | %%% <?php echo get_option('show'); ?> %%% | ||
== Examples == | == Examples == | ||
== 例子 == | |||
=== Show Blog Title === | === Show Blog Title === | ||
=== 显示博客标题 === | |||
Displays your blog's title in a <h1> tag. | Displays your blog's title in a <h1> tag. | ||
在<h1>标签中显示你的博客标题。 | |||
%%% <h1><?php echo get_option('blogname'); ?></h1> %%% | |||
%%% <h1><?php echo get_option('blogname'); ?></h1> %%% | %%% <h1><?php echo get_option('blogname'); ?></h1> %%% | ||
=== Show Character Set === | === Show Character Set === | ||
=== 显示字符集=== | |||
Displays the character set your blog is using (ex: UTF-8) | Displays the character set your blog is using (ex: UTF-8) | ||
显示你的博客使用的字符集(例如:UTF-8) | |||
%%% <p>Character set: <?php echo get_option('blog_charset'); ?> </p> %%% | |||
%%% <p>Character set: <?php echo get_option('blog_charset'); ?> </p> %%% | %%% <p>Character set: <?php echo get_option('blog_charset'); ?> </p> %%% | ||
===Retrieve Administrator E-mail=== | ===Retrieve Administrator E-mail=== | ||
===得到管理员电子邮件=== | |||
Retrieve the e-mail of the blog administrator, storing it in a variable. | Retrieve the e-mail of the blog administrator, storing it in a variable. | ||
得到博客管理员的电子邮件并且将电子邮件储存在一个变数中。 | |||
%%% <?php $admin_email = get_option('admin_email'); ?> %%% | |||
%%% <?php $admin_email = get_option('admin_email'); ?> %%% | %%% <?php $admin_email = get_option('admin_email'); ?> %%% | ||
== Parameters == | == Parameters == | ||
== 参数 == | |||
{{Parameter|$show|string|Name of the option to retrieve. A list of valid default options can be found at the [[WordPress:Option Reference]].}} | {{Parameter|$show|string|Name of the option to retrieve. A list of valid default options can be found at the [[WordPress:Option Reference]].}} | ||
{{Parameter|$show|string|得到选项名称。可以在[[WordPress:Option Reference|选项参考]]中找到有效的默认选项的列表。}} | |||
== Related == | == Related == | ||
== 相关的 == | |||
{{Tag General Tags}} | {{Tag General Tags}} | ||
{{Tag Footer}} | {{Tag Footer}} | ||
{{标签总标签}} | |||
{{标签页底文字}} |
2008年7月22日 (二) 13:27的版本
Description
描述
A safe way of getting values for a named option from the options database table. If the desired option does not exist, FALSE will be returned. 为选项数据库表格中安全地得到指定的一个选项的参数值。如果没有想要的选项,会返回错误的。
Usage
用法
%%% <?php echo get_option('show'); ?> %%%
%%% <?php echo get_option('show'); ?> %%%
Examples
例子
Show Blog Title
显示博客标题
Displays your blog's title in a <h1> tag.
在<h1>标签中显示你的博客标题。
%%%
<?php echo get_option('blogname'); ?>
%%% %%%
<?php echo get_option('blogname'); ?>
%%%
Show Character Set
显示字符集
Displays the character set your blog is using (ex: UTF-8)
显示你的博客使用的字符集(例如:UTF-8)
%%%
Character set: <?php echo get_option('blog_charset'); ?>
%%% %%%
Character set: <?php echo get_option('blog_charset'); ?>
%%%
Retrieve Administrator E-mail
得到管理员电子邮件
Retrieve the e-mail of the blog administrator, storing it in a variable.
得到博客管理员的电子邮件并且将电子邮件储存在一个变数中。
%%% <?php $admin_email = get_option('admin_email'); ?> %%%
%%% <?php $admin_email = get_option('admin_email'); ?> %%%