0

I need to edit a few files that are part of a parent theme that I am using. I have put them in the child theme folder.

Now I need to deal with the function for it.

This is the function in the parent theme's functions.php file. The function references the files that I need to edit and of course I could edit them in the parent theme but then that defeats the purpose of a child theme with theme updates.

function kioken_builder_init() {

    if(is_admin()){

    if ( defined('WPB_VC_VERSION') ) {        

        require_once (KIO_FUNC_DIR . 'builder/k_image.php');
        require_once (KIO_FUNC_DIR . 'builder/team.php');
        require_once (KIO_FUNC_DIR . 'builder/additionals.php');
        require_once (KIO_FUNC_DIR . 'builder/testimonial_slider.php');    

        require_once (KIO_FUNC_DIR . 'builder/types/iconselector.php');
        require_once (KIO_FUNC_DIR . 'builder/types/kioconpicker.php');
        require_once (KIO_FUNC_DIR . 'builder/types/dropdown_multi.php');


    }      
    }

}

add_action('admin_init', 'kioken_builder_init');

if (defined('WPB_VC_VERSION')) {
        $tmpdir = get_stylesheet_directory() . '/kioken/functions/builder/vc_templates/';
        vc_set_template_dir($tmpdir);
        require_once (KIO_FUNC_DIR . 'builder/builder_row.php');
        require_once (KIO_FUNC_DIR . 'builder/builder_column.php');

}
1

In your child functions file, try:

remove_action('admin_init', 'kioken_builder_init');

function ben_kioken_builder_init() {

    if ( defined('WPB_VC_VERSION') ) {         
       //etc
    }    
}
add_action('admin_init', 'ben_kioken_builder_init');

You don't need the if(is_admin()) check because admin_init only fires on admin pages.

| improve this answer | |
  • The child functions file loads before the parent functions file, so I have doubts about this solution. That is, kioken_builder_initwill be hooked in after you try to remove it. Have you tested this solution? – s_ha_dum Oct 12 '14 at 23:35
  • Ah, load order issues. No I haven't tested. So how do you remove an add_action from a parent theme? – shanebp Oct 12 '14 at 23:55
  • Look at the priority parameter for add_action. You will need to be clever with that. – s_ha_dum Oct 13 '14 at 0:03
  • @shanebp that didn't give me any errors but I think its seeing the folder/files? Unless I put the other code after the add action but I don't think I need that. – benlevywebdesign Oct 13 '14 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.