Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Hi all,
In my child theme, I’m trying to have my childfunctions.php file replace some of the code from the Vantage theme’s functions.php file. How would I do that for this particular piece of code :
/** * Register widgetized area and update sidebar with default widgets * * @since vantage 1.0 */ function vantage_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'vantage' ), 'id' => 'sidebar-1', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); register_sidebar( array( 'name' => __( 'Footer', 'vantage' ), 'id' => 'sidebar-footer', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); register_sidebar( array( 'name' => __( 'Header', 'vantage' ), 'id' => 'sidebar-header', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); } add_action( 'widgets_init', 'vantage_widgets_init' );
I have tried using add_action and remove_action and obviously something’s amiss…
I should have made those functions pluggable, but there’s a work around for this. Disclaimer: I haven’t checked any of the following code.
Basically the problem is that the child theme’s functions.php is included before the parent theme’s functions.php. So if you call remove_action in the child theme, it needs to be at a point after the parent theme has added the action. Throwing it in an init function does the trick.
And it works! Thank you for the quick response!
Any time Cedric :)