Forum Replies Created

Viewing 1 replies (of 1 total)
  • Brand new to WordPress and PHP, but I was able to replace the product search with the generic search by adding the following to the functions.php file of my child theme (my child theme header is almost identical to the WooCommerce parent):

    //replace product search in header with site search
    
    function child_theme_replace_header_search() {
        remove_action( 'storefront_header', 'storefront_product_search', 40 );
        add_action( 'storefront_header', 'replacement_header_search', 40 );
    }
    
    function replacement_header_search () {
        ?>
        <div class="site-search">
            <?php the_widget( 'WP_Widget_Search', 'title=' ); ?>
        </div>
        <?php
    }
    
    add_action( 'init', 'child_theme_replace_header_search' );

    Someone more knowledgeable may have some feedback on how correct or incorrect that approach is, but it seems to work in my case.

Viewing 1 replies (of 1 total)