Reputation: 59
I'm fairly new to WP. I'm using the shop-isle theme that has its default search bar. I'm trying to override this search functionality with a custom search.
Theme header is loaded from directory shop-isle/inc/structure/header.php. I copied the entire directory to my child theme directory and made edits, but it does not work. I read on other post that inc files can't be overridden as they are not template files. I tried unhooking the function that loads the header but that removes the header all together!
The main header.php calls shop-isle/inc/structure/header.php. using
<?php do_action( 'shop_isle_header' ); ?>
The hooks.php located in shop-isle/inc/structure/hooks.php has the callback function registered using
add_action( 'shop_isle_header', 'shop_isle_primary_navigation', 50 );
I've copied all these files over to my child theme so i can edit the shop_isle_primary_navigation callback function but it does not override the parent files.
Upvotes: 1
Views: 1344
Reputation: 965
You should put your modified shop_isle_primary_navigation function in child theme functions.php.
The child theme functions get loaded before functions from the parent theme. Since these are enclosed in if ( ! function_exists ( 'some_function' ) ) { ... }
they won't be loaded.
No need to copy everything to child theme directory.
Upvotes: 2