デフォルトでは「ウジェット機能」はoffになっているので、まずはfunctions.phpに「ウジェット機能」を有効にする記述をします。
//ウジェットエリアを有効にする function custom_widget_register(){ register_sidebar(array( 'name' => 'サイドバーウィジェットエリア', 'id' => 'sidebar-widget', 'description' => 'ブログページのサイドバーに表示されます', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="c-widget__title">', 'after_title' => '</h2>' )); } add_action('widgets_init', 'custom_widget_register');
これでダッシュボード上で「ウジェット機能」の設定が可能になります。
次にダッシュボードで「ウジェット機能」の設定をします。
今回は
- 検索
- 最近の投稿
- カレンダー
- カテゴリー
の4つの機能を使用します。