Hello,
I installed the plugin “Ajax Search Pro” to improve the search.
The plugin works. But there is a problem. In the menu, the search with the plugin does not work.
The developer writes:
The problem is, that the menu clones search container, which basically resets the event handlers, thus it won’t work. I have constructed a custom, that checks when the icon is clicked, and tries to re-initialize the plugin, and should bypass the problem.
Try adding this custom code to the functions.php in your theme/child theme directory.
add_action('wp_footer', 'asp_fix_fa_icon_click');
function asp_fix_fa_icon_click() {
?>
<script>
jQuery(function($){
$('#menu-item-search').on('click', function(){
setTimeout(function(){
ASP.initialize();
}, 500);
});
});
</script>
<?php
}
Can I install the code safely? I’m a little scared to break something.
Can I override the “new” functions.php without any problems with the old file if something goes wrong?
best regards
Florian
Hey Florian,
You should be able to try it out, you can simply remove it if it should break anything.
Best regards,
Rikard
Perfect, it works!
Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon