Unsure how to hook functions in child functions.php
-
Hi all,
The current theme that I am using is Interface (free) by theme horse. I am trying to edit some code in the header-extensions.php file. In the directory of the parent theme, it is located in interface/inc.structure. I created a copy of the header-extensions.php file in my child theme directory in interface-child/inc/structure. Any edits I make to the child theme header-extensions.php file are not applying.
From what I understand from my research I need to unhook the function in the parent functions.php file that loads the file from parent directory. The parent functions.php code is the following:
function interface_load_files() { /** * interface_add_files hook * * Adding other addtional files if needed. */ do_action( 'interface_add_files' ); /** Load functions */ require_once( INTERFACE_FUNCTIONS_DIR . '/i18n.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/custom-header.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/functions.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/custom-style.php' ); require_once( INTERFACE_ADMIN_DIR . '/interface-themedefaults-value.php' ); require_once( INTERFACE_ADMIN_DIR . '/theme-option.php' ); require_once( INTERFACE_ADMIN_DIR . '/interface-metaboxes.php' ); /** Load Shortcodes */ require_once( INTERFACE_SHORTCODES_DIR . '/interface-footer_info.php' ); /** Load Structure */ require_once( INTERFACE_STRUCTURE_DIR . '/header-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/searchform-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/sidebar-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/footer-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/content-extensions.php' ); /** Load Widgets and Widgetized Area */ require_once( INTERFACE_WIDGETS_DIR . '/interface_widgets.php' ); }
The code in my child functions.php file is the following:
<?php function unhook_thematic_functions(){ remove_action('interface_init', 'interface_load_files', 15); } add_action('init', 'unhook_thematic_functions'); add_action( 'interface_init', 'interface_child_load_files', 15 ); function interface_child_load_files() { /** * interface_add_files hook * * Adding other addtional files if needed. */ do_action( 'interface_add_files' ); /** Load functions */ require_once( INTERFACE_FUNCTIONS_DIR . '/i18n.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/custom-header.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/functions.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/custom-style.php' ); require_once( INTERFACE_ADMIN_DIR . '/interface-themedefaults-value.php' ); require_once( INTERFACE_ADMIN_DIR . '/theme-option.php' ); require_once( INTERFACE_ADMIN_DIR . '/interface-metaboxes.php' ); /** Load Shortcodes */ require_once( INTERFACE_SHORTCODES_DIR . '/interface-footer_info.php' ); /** Load Structure */ require_once( INTERFACE_STRUCTURE_DIR . '/header-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/searchform-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/sidebar-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/footer-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/content-extensions.php' ); /** Load Widgets and Widgetized Area */ require_once( INTERFACE_WIDGETS_DIR . '/interface_widgets.php' ); } ?>
My guess is that the directory
(INTERFACE_STRUCTURE_DIR . '/header-extensions.php')
should be changed, but I’m not sure to what.Any help is appreciated, thanks.
- The topic ‘Unsure how to hook functions in child functions.php’ is closed to new replies.