A WordPress theme theme overrides the parent theme:

I am creating a child WordPress theme and must overwrite certain widget templates. I am trying to use this method to override the call to the parent theme: The correct way to override theme functions .

However, I am currently getting this error:

Fatal error: unable to update hickory_homepage_load_widget () (previously declared in C: \ WAMP \ WWW \ greenpeaceNewBlog \ content-content \ Themes \ zm-blog \ on \ Widgets \ homepage_widget.php: 8) in C: \ WAMP \ WWW \ greenpeaceNewBlog \ sor content \ Themes \ hickory \ on \ widgets \ homepage_widget.php on line 10

The native functions.php theme calls templates as follows:

include("inc/widgets/homepage_widget.php"); 

The homepage_widget.php file contains the following:

 add_action( 'widgets_init', 'hickory_homepage_load_widget' ); function hickory_homepage_load_widget() { register_widget( 'hickory_homepage_widget' ); } 

I have a child object that duplicates the widget directory (stylesheet_directory / inc / widgets / ..) and a child theme functions.php. In my child functions.php, I wrote this:

 // 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"); 

Please, help:)

Greetings

0
source share
1 answer

try it

 add_action( 'init', 'remove_hickory_widgets' ); function remove_hickory_widgets() { remove_action('widgets_init', 'hickory_homepage_load_widget' ); add_action( 'init', 'custom_widgets' ); } function custom_widgets(){ // your widget code here } 
0
source

All Articles