#問題点
wordpressのダッシュボードの外観にウィジェットを追加したいです。
#試したこと
・以下のコードを追加。
php
1register_sidebar();
fnction.phpのコード
php
1<?php 2add_theme_support('title-tag');//titleタグをhead内に生成 3add_theme_support('heml5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption') )//html5でマークアップ 4add_theme_support('automatic-feed-links' );//Feedリンクを自動生成 5add_theme_support('post-thumbnails');//サムネイルが可能 6 7register_sidebar(); 8 9/* -------------------------------- 10 * サイドバーをウィジェット追加 11 * -------------------------------- */ 12 function widgetarea_init() { 13 register_sidebar(array( 14 'name' =>'サイドバー', 15 'id' =>'side-widget', 16 'before_widget'=>'<div id="%1$s" class="%2$s sidebar-wrapper widget">', 17 'after_widget'=>'</div>', 18 'before_title' =>'<h4 class="sidebar-title">', 19 'afeter_title' =>'</h4>' 20 )); 21 } 22 add_action( 'widgets_init', 'widgetarea_init' );//なにこれ? 23 24 /* -------------------------------- 25 * ソーシャルURLをダッシュボードから設定可能にする 26 * -------------------------------- */ 27 28function my_user_meta($prof_items) { 29 $prof_items['twitter_url']='URL:twitter'; 30 $prof_items['facebook_url']='URL:facebook'; 31 $prof_items['instagram_url']='URL:Instagram'; 32 return $prof_items; 33} 34add_filter('user_contactmethods','my_user_meta') 35 36//ウィジェット 37register_sidebar(); 38
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。