[WordPress General] ウィジェットエリアを追加する
memo.
functions.php で有効化します。
「外観 > ウィジェット」にウィジェットエリアが表示されるようになります。
“`php:functions.php
register_sidebar( array(
‘name’ => ‘Widget-blog-archives’,
‘id’ => ‘Widget-blog-archives’,
‘description’ => ‘ブログアーカイブのウィジットエリアです。’,
‘before_widget’ => ‘
‘,
) );
“`
ウィジェットを表示したいビュー?に下記のように記載します。
“`php:index.php
“`
> * [関数リファレンス/is active sidebar – WordPress Codex 日本語版](http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/is_active_sidebar)
> * [関数リファレンス/dynamic sidebar – WordPress Codex 日本語版](http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/dynamic_sidebar)
WordPress 4.0-beta4 で is_active_sidebar の true/false の値が逆で返ってくるような気がする。#wordpressjp
— DriftwoodJP (@DriftwoodJP) August 25, 2014