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

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

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

提供: WordPress Codex 日本語版
移動先: 案内検索
(ページの作成:「== Description == De-registers a previously registered sidebar. == Usage == %%% <?php unregister_sidebar( $id ); ?> %%% == Parameters == {{Parameter|$id|...」)
 
(見出し�部分の訳)
1行目: 1行目:
== Description ==
+
== 概要 ==
  
 
De-registers a previously registered [[Sidebars|sidebar]].
 
De-registers a previously registered [[Sidebars|sidebar]].
  
== Usage ==
+
== 使い方 ==
  
%%% <?php unregister_sidebar( $id ); ?> %%%
+
<?php unregister_sidebar( $id ); ?>
  
== Parameters ==
+
== パラメータ ==
  
 
{{Parameter|$id|string|The ID of the sidebar when it was added.}}
 
{{Parameter|$id|string|The ID of the sidebar when it was added.}}
  
== Example ==
+
== 用例 ==
  
 
If added to a child theme's functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.
 
If added to a child theme's functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.
27行目: 27行目:
 
</pre>
 
</pre>
  
== Notes ==
+
== ==
  
 
In the example, note that we assign a priority of 11 when registering the widgets_init hook. This is because a child theme's functions.php file is called before the parent theme's, which means that our call to unregister_sidebar() would accomplish nothing since the sidebar has not yet been registered.
 
In the example, note that we assign a priority of 11 when registering the widgets_init hook. This is because a child theme's functions.php file is called before the parent theme's, which means that our call to unregister_sidebar() would accomplish nothing since the sidebar has not yet been registered.
33行目: 33行目:
 
By lowering the priority of our action, we ensure that it is called after the parent theme's functions.php file is loaded.
 
By lowering the priority of our action, we ensure that it is called after the parent theme's functions.php file is loaded.
  
== Change Log ==
+
== 更新履歴 ==
  
Since: 2.2.0
+
新規導入: 2.2.0
  
== Source File ==
+
== ソースファイル ==
  
<tt>unregister_sidebar()</tt> is located in {{Trac|wp-includes/widgets.php}}.
+
<tt>unregister_sidebar()</tt> {{Trac|wp-includes/widgets.php}}にあります。
  
== Related ==
+
== 関連 ==
  
 
{{Sidebar Tags}}
 
{{Sidebar Tags}}

2015年7月24日 (金) 23:58時点における版

概要

De-registers a previously registered sidebar.

使い方

<?php unregister_sidebar( $id ); ?>

パラメータ

$id
string) (必須) The ID of the sidebar when it was added.
初期値: なし

用例

If added to a child theme's functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.

function remove_some_widgets(){

	// Unregister some of the TwentyTen sidebars
	unregister_sidebar( 'first-footer-widget-area' );
	unregister_sidebar( 'second-footer-widget-area' );
	unregister_sidebar( 'third-footer-widget-area' );
	unregister_sidebar( 'fourth-footer-widget-area' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );

In the example, note that we assign a priority of 11 when registering the widgets_init hook. This is because a child theme's functions.php file is called before the parent theme's, which means that our call to unregister_sidebar() would accomplish nothing since the sidebar has not yet been registered.

By lowering the priority of our action, we ensure that it is called after the parent theme's functions.php file is loaded.

更新履歴

新規導入: 2.2.0

ソースファイル

unregister_sidebar()wp-includes/widgets.phpにあります。

関連

サイドバー: is_active_sidebar(), is_dynamic_sidebar(), dynamic_sidebar(), register_sidebars(), register_sidebar(), unregister_sidebar(), wp_register_sidebar_widget() / en, wp_unregister_sidebar_widget() / en, wp_get_sidebars_widgets() / en, wp_set_sidebars_widgets() / en,



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