1
votes

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.

1
do you want to customise the result of the search or the search field presentation ?mmm
both i guess... right now it uses get method to populate search results but i would like to use post to get search results from APInash63
POST request are used to edit data. to show something like a search result, it's better to use a GET requestmmm

1 Answers

1
votes

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.