Last active
April 29, 2022 13:28
-
-
Save diviengine/02d0601d33826c309c5e7ccbaf1d4c7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($){ // wait for jQuery to load | |
// dynamically add the input below the search box that tells the search that the post type to search are products. | |
$(".et-search-form").append('<input type="hidden" name="post_type" value="product" />'); | |
// now for each search box from the Divi module | |
$(".et_pb_menu__search-form").each(function() { | |
$(this).append('<input type="hidden" name="post_type" value="product" />'); | |
}); | |
// now for each search box from the Divi theme builder header | |
$(".et_pb_searchform").each(function() { | |
$(this).find('div').append('<input type="hidden" name="post_type" value="product" />'); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment