Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Unclickable images › Reply To: Unclickable images
July 6, 2024 at 10:31 am
#48715
Keymaster
You are right, I think we need a different approach. Scratch that custom CSS, it’s not going to work.
Instead, I have constructed a custom code for you. This will basically override all clicks, but nothing else and prevent any redirection.
add_action('wp_footer', function() {
?>
<script>
window.addEventListener("load", () => {
document.querySelectorAll(".asp_main_container").forEach((el)=>{
el.addEventListener("asp_results_show", ()=>{
setTimeout(()=>{
WPD.dom('.item').off().on('click touchstart', (event)=>{
event.preventDefault();
});
}, 50);
});
});
});
</script>
<?php
});
Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.