• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「関数リファレンス/get option」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Function Reference/get_option 13:15, 29 June 2010 Bono 版を翻訳用にコピー)
 
(日本語版向けに調整/未翻訳)
1行目: 1行目:
 +
{{NeedTrans}}
 +
 +
{{テンプレートタグガイド|PHP}}
 +
 
== Description ==
 
== Description ==
  
5行目: 9行目:
 
== Usage ==
 
== Usage ==
  
%%% <?php echo get_option( $show, $default ); ?> %%%
+
<?php echo get_option( $show, $default ); ?>
  
== Parameters ==
+
== Parameters <span id="Parameters"></span>==
  
 
{{Parameter|$show|string|Name of the option to retrieve. A list of valid default options can be found at the [[Option Reference]].}}
 
{{Parameter|$show|string|Name of the option to retrieve. A list of valid default options can be found at the [[Option Reference]].}}
13行目: 17行目:
 
{{Parameter|$default|mixed|The default value to return if no value is returned (ie. the option is not in the database).|optional|false}}
 
{{Parameter|$default|mixed|The default value to return if no value is returned (ie. the option is not in the database).|optional|false}}
  
== Values ==
+
== Values <span id="Values"></span>==
 
More information: [[Option_Reference]]
 
More information: [[Option_Reference]]
  
== Examples ==
+
== Examples <span id="Examples"></span>==
  
 
=== Show Blog Title ===
 
=== Show Blog Title ===
22行目: 26行目:
 
Displays your blog's title in a &lt;h1&gt; tag.
 
Displays your blog's title in a &lt;h1&gt; tag.
  
%%% <h1><?php echo get_option('blogname'); ?></h1> %%%
+
<pre><h1><?php echo get_option('blogname'); ?></h1></pre>
  
 
=== Show Character Set ===
 
=== Show Character Set ===
28行目: 32行目:
 
Displays the character set your blog is using (ex: UTF-8)
 
Displays the character set your blog is using (ex: UTF-8)
  
%%% <p>Character set: <?php echo get_option('blog_charset'); ?> </p> %%%
+
<pre><p>Character set: <?php echo get_option('blog_charset'); ?> </p></pre>
  
 
===Retrieve Administrator E-mail===
 
===Retrieve Administrator E-mail===
34行目: 38行目:
 
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'); ?>
  
== Changelog ==
+
== 更新履歴 ==
  
 
* since 1.5.0
 
* since 1.5.0
  
== Source Code ==
+
== ソースコード ==
  
<code>get_option()</code> is located in
+
<code>get_option()</code> {{Source|wp-includes/functions.php}} にあります({{CurrentVersion}}: 最新安定版)。
* {{Source|wp-includes/functions.php}} ({{CurrentVersion}}: the latest stable version)
+
* {{Source|wp-includes/functions.php|trunk}}  (the development version)
+
  
 
{{原文|Function Reference/get_option|90974}}<!-- 13:15, 29 June 2010 Bono 版 -->
 
{{原文|Function Reference/get_option|90974}}<!-- 13:15, 29 June 2010 Bono 版 -->
  
== Related ==
+
== 関連 ==
  
 
{{Option Tags}}
 
{{Option Tags}}
54行目: 56行目:
 
{{Tag Footer}}
 
{{Tag Footer}}
  
[[Category:Functions]]
+
{{DEFAULTSORT:Get_option}}
 +
[[Category:関数]]
  
 
[[en:Function Reference/get_option]]
 
[[en:Function Reference/get_option]]
 
[[ru:Справочник_по_функциям/get_option]]
 
[[ru:Справочник_по_функциям/get_option]]
 
[[vi:Tham Khảo Các Hàm/get_option]]
 
[[vi:Tham Khảo Các Hàm/get_option]]

2010年6月29日 (火) 22:27時点における版

このページ「関数リファレンス/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, or no value is associated with it, FALSE will be returned.

Usage

<?php echo get_option( $show, $default ); ?>

Parameters

$show
string) (必須) Name of the option to retrieve. A list of valid default options can be found at the Option Reference.
初期値: なし
$default
mixed) (optional) The default value to return if no value is returned (ie. the option is not in the database).
初期値: false

Values

More information: Option_Reference

Examples

Show Blog Title

Displays your blog's title in a <h1> tag.

<h1><?php echo get_option('blogname'); ?></h1>

Show Character Set

Displays the character set your blog is using (ex: UTF-8)

<p>Character set: <?php echo get_option('blog_charset'); ?> </p>

Retrieve Administrator E-mail

Retrieve the e-mail of the blog administrator, storing it in a variable.

<?php $admin_email = get_option('admin_email'); ?>

更新履歴

  • since 1.5.0

ソースコード

get_option()wp-includes/functions.php にあります(5.3: 最新安定版)。

最新英語版: WordPress Codex » Function Reference/get_option最新版との差分

関連

Options API: add_option() /en, add_site_option() /en, delete_option() /en, delete_site_option() /en, form_option() /en, get_site_option() /en, get_site_url(), get_user_option() /en, get_option() /en, update_option() /en, update_site_option() /en, update_user_option() /en, wp_load_alloptions() /en



関数リファレンステンプレートタグ目次もご覧ください。