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

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

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

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Function Reference/dynamic_sidebar 11:17, 28 September 2009 Ramiy 版を翻訳用にコピー)
 
(整形、未翻訳)
1行目: 1行目:
 +
{{NeedTrans}}
 
== Description ==
 
== Description ==
  
9行目: 10行目:
 
== Usage ==
 
== Usage ==
  
%%% <?php dynamic_sidebar( $number ); ?> %%%
+
<?php dynamic_sidebar( $number ); ?>
  
 
== Parameters ==
 
== Parameters ==
58行目: 59行目:
 
{{Tag Footer}}
 
{{Tag Footer}}
  
[[Category:Functions]]
+
{{DEFAULTSORT:Dynamic_sidebar}}
[[Category:Widgets]]
+
[[Category:ウィジェット]]
 +
[[Category:wp2.2]]
  
 
[[en:Function Reference/dynamic_sidebar]]
 
[[en:Function Reference/dynamic_sidebar]]

2010年3月3日 (水) 22:20時点における版

このページ「関数リファレンス/dynamic sidebar」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

Description

This function calls each of the active widget callbacks in order, which prints the markup for the sidebar. If you have more than one sidebar, you should give this function the name or number of the sidebar you want to print. This function returns true on success and false on failure.

The return value should be used to determine whether to display a static sidebar. This ensures that your theme will look good even when the Widgets plug-in is not active.

If your sidebars were registered by number, they should be retrieved by number. If they had names when you registered them, use their names to retrieve them.

Usage

<?php dynamic_sidebar( $number ); ?>

Parameters

$number
int/string) (optional) Name or ID of dynamic sidebar.
初期値: 1

Return Value

(boolean) 
True, if widget sidebar was found and called. False if not found or not called.

Examples

Here is the recommended use of this function:

 <ul id="sidebar">
 <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    <li>{static sidebar item 1}</li>
    <li>{static sidebar item 2}</li>
 <?php endif; ?>
 </ul>

Multiple Sidebars

You can load a specific sidebar by either their name (if given a string) or ID (if given an integer). For example, dynamic_sidebar('top_menu') will present a sidebar registered with register_sidebar(array('name'=>'top_menu',)).

Using ID's ( dynamic_sidebar(1) ) is easier in that you don't need to name your sidebar, but they are harder to figure out which is which without looking into your functions.php file or in the widgets administration panel and thus make your code less readable. Note that ID's begin at 1.

Change Log

Since: 2.2.0

Source File

dynamic_sidebar() is located in wp-includes/widgets.php.

Further Reading

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

Related

ウィジェット API: is_active_widget(), the_widget(), register_widget(), unregister_widget() / en, wp_register_widget_control() / en, wp_unregister_widget_control() / en, wp_convert_widget_settings() / en, wp_get_widget_defaults() / en, wp_widget_description() / en



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