Forums

[resolved] Remove Function from Parent Theme (4 posts)

  1. psiweb
    Member
    Posted 4 months ago #

    Hi Everyone,
    I am trying to remove a function from a parent theme and insert my own from the functions.php in my child theme. Actually I just want to update one little piece of the code everything else I can control via css. I am using Sandbox as my parent theme and I would like to change the function:

    sandbox_widgets_init

    I can not figure out how to do this, I have been trying to research it and maybe I am just missing something as I am fairly new to wordpress development, any suggestions would be greatly appreciated.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    You will need to create your own version of the sandbox_widgets_init() function in your child theme's functions.php file.

  3. psiweb
    Member
    Posted 4 months ago #

    Thanks for the reply. I had tried to do this and it gives me an error:
    Fatal error: Cannot redeclare sandbox_widgets_init() (previously declared...

  4. psiweb
    Member
    Posted 4 months ago #

    As usual, I think I tried to over complicate this, I was able to get my function to work by removing the action and adding my action to it simply by adding the code below:

    remove_action( 'init', 'sandbox_widgets_init' );
    
    add_action( 'init', 'mysandbox_widgets_init' );

    Thanks for the quick reply.

Reply

You must log in to post.

About this Topic