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

Reply To: First item in search results displaying twice

Home Forums Product Support Forums Ajax Search Pro for WordPress Support First item in search results displaying twice Reply To: First item in search results displaying twice

#38457
Ernest MarcinkoErnest Marcinko
Keymaster

That’s a bummer.

Anyways, I figured out a very simple hacky solution. I don’t know how effective this is going to be, or how long is usable though. Basically a small custom code, which triggers whenever ajax search pro finishes with the results. When it triggers, it fetches the items, and hides the very first one – and that’s it.

add_action('wp_footer', 'asp_custom_footer_script', 99999);
function asp_custom_footer_script() {
	?>
	<script>
	(function($){
		$('.asp_m_1').on('asp_elementor_results', function(){
			$($('.asp_es_1 .elementor-post').get(0)).css('display', 'none');
		});
	}(WPD.dom));
	</script>
	<?php
}

Try adding this code 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.