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
July 18, 2022 at 6:34 am
#38457
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.