YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* 親テーマのウィジェットを子テーマで上書きする [#qc10528e]
*** 子テーマのfunctions.php [#l17380db]
function my_widgets_init() {
register_widget( 'X_Archives_Widget' );
register_sidebar(array() );
}
function remove_parent_widgets() {
remove_action( 'widgets_init', 'twentysixteen_widget...
}
add_action('after_setup_theme', 'remove_parent_widgets');
add_action('after_setup_theme', 'my_widgets_init');
- 親テーマのfunctions.phpの中にあるwidgets_initを確認する。
-- 今回はtwentysixteen_widgets_init。
- そのwidgets_initをremove_action()で削除する関数を、子テ...
-- 今回はremove_parent_widgets()。
- その関数呼ぶため、after_setup_themeでadd_action()する。
- さらにafter_setup_themeでadd_action()して、今度は子テー...
-- 今回はmy_widgets_init()呼んでいる。
** 参考 [#re3866e1]
http://wordpress.stackexchange.com/questions/235156/how-t...
終了行:
* 親テーマのウィジェットを子テーマで上書きする [#qc10528e]
*** 子テーマのfunctions.php [#l17380db]
function my_widgets_init() {
register_widget( 'X_Archives_Widget' );
register_sidebar(array() );
}
function remove_parent_widgets() {
remove_action( 'widgets_init', 'twentysixteen_widget...
}
add_action('after_setup_theme', 'remove_parent_widgets');
add_action('after_setup_theme', 'my_widgets_init');
- 親テーマのfunctions.phpの中にあるwidgets_initを確認する。
-- 今回はtwentysixteen_widgets_init。
- そのwidgets_initをremove_action()で削除する関数を、子テ...
-- 今回はremove_parent_widgets()。
- その関数呼ぶため、after_setup_themeでadd_action()する。
- さらにafter_setup_themeでadd_action()して、今度は子テー...
-- 今回はmy_widgets_init()呼んでいる。
** 参考 [#re3866e1]
http://wordpress.stackexchange.com/questions/235156/how-t...
ページ名: