Tema filho WordPress substituir um tema pai incluem
Estou criando um tema filho do WordPress e preciso sobrescrever certos modelos de widgets. Eu estou tentando usar esse método para substituir a chamada do tema pai:O caminho certo para substituir as funções do tema.
No entanto, atualmente recebo este erro:
Erro fatal: Não é possível redeclarar hickory_homepage_load_widget () (anteriormente declarado em C: \ wamp \ www \ greenpeaceNewBlog \ wp-content \ themes \ gp-blog \ inc \ widgets \ homepage_widget.php: 8) em C: \ wamp \ www \ greenpeaceNewBlog \ wp-content \ temas \ hickory \ inc \ widgets \ homepage_widget.php na linha 10
O tema pai functions.php chama os modelos assim:
include("inc/widgets/homepage_widget.php");
O arquivo homepage_widget.php contém isto:
add_action( 'widgets_init', 'hickory_homepage_load_widget' );
function hickory_homepage_load_widget() {
register_widget( 'hickory_homepage_widget' );
}
Eu tenho um diretório de widget duplicado de tema filho (stylesheet_directory / inc / widgets / ..) e um childfost functions.php. No meu filho functions.php, escrevi isto:
// Remove the default Thematic blogtitle function
function remove_hickory_widgets() {
remove_action('widgets_init', 'hickory_homepage_load_widget');
}
// Call 'remove_thematic_actions' (above) during WP initialization
add_action('init','remove_hickory_widgets');
include("inc/widgets/homepage_widget.php");
Por favor ajude :)
Felicidades