This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Ajax Search with Elementor Pro results displaying twice

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Ajax Search with Elementor Pro results displaying twice Reply To: Ajax Search with Elementor Pro results displaying twice

#44720
Ernest MarcinkoErnest Marcinko
Keymaster

Sure! Can you try maybe this variation:

add_action('wp_footer', 'asp_custom_footer_script', 99999);
function asp_custom_footer_script() {
	?>
	<script>
	window.addEventListener("load", (event) => {
		(function($){
			$('.asp_m').on('asp_elementor_results', function(){
				let id = $(this).data('id');
				let seen = [];
				$('.asp_es_' + id + ' .elementor-post').each(function(){
					if ( seen.includes(this.className) ) {
						$(this).remove();
					} else {
						seen.push(this.className);
					}
				});
			});
		}(WPD.dom));
	});
	</script>
	<?php
}