「外観」>「ウィジェット」ページにて、「利用できるウィジェット」に任意のHTMLを設定したウィジェットを追加したいのですが、方法がわかりません。
Bizvektor というテーマを入れて、色々と試しておりそれらしい個所を見つけてイジってはいるのですが、全く反応せず・・。
下記がそれらしい個所になります。
↓themes/hogehoge/widgets/widgets.php↓
php
1/*-------------------------------------------*/ 2/* Top Info list widget 3/*-------------------------------------------*/ 4class WP_Widget_top_list_info extends WP_Widget { 5 6 function __construct() { 7 $biz_vektor_options = biz_vektor_get_theme_options(); 8 9 $widget_name = biz_vektor_get_short_name() . '_' . sprintf( __( '%1$s list for top', 'biz-vektor' ), $biz_vektor_options['infoLabelName'] ); 10 11 parent::__construct( 12 'top_list_info', 13 $widget_name, 14 array( 'description' => sprintf( __( 'Displays recent %1$s posts.', 'biz-vektor' ), $biz_vektor_options['infoLabelName'] ) ) 15 ); 16 } 17 18 function widget($args, $instance) { 19 // echo $before_widget; 20 get_template_part( 'module_top_list_info' ); 21 // echo $after_widget; 22 } 23 24 function form($instance){ 25 } 26 27 function update($new_instance,$old_instance){ 28 return $new_instance; 29 } 30} // class WP_Widget_top_list_info 31add_action('widgets_init', create_function('', 'return register_widget("WP_Widget_top_list_info");'));
「WP_Widget_top_list_info」を任意の名前にして、「get_template_part( 'module_top_list_info' );」に、HTMLを書いているのですが、反映がされませんでした。
そもそも、「themes/hogehoge/widgets/widgets.php」の中身をまるごと消しても、管理画面には何も起こらなかったので、本当にこのファイルなのかすら怪しいです。゚(゚´Д`゚)゚。
参考文献でも構いませんのご教授ください。
よろしくお願いします。
Wordpress : 4.4
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。