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

Reply To: Display the results information box problem.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Display the results information box problem. Reply To: Display the results information box problem.

#35517
danilocubrovic05danilocubrovic05
Participant

Well I kind of glue this thing but still want to check if I’m missing something. Maybe there is an better solution for this.
I have use asp_results filter to set number of results in global variable so I can use this number for number of results if ajax search is executed.

add_shortcode( ‘cekos_elementor_php_output_search_results_info’, ‘get_output_search_results_info’ );

function get_output_search_results_info( $atts) {
global $archive_count_results;
$post_count = $GLOBALS[‘wp_query’]->found_posts;
if ($archive_count_results){
return “Found ” . $archive_count_results.” results from “.$post_count.” posts”;
}else{
return “Found ” . $post_count.” results from “.$post_count.” posts”;
}
}

add_filter( ‘asp_results’, ‘asp_custom_link_results’, 10, 1 );
function asp_custom_link_results( $results ) {
global $archive_count_results;
$count_results = count($results);
$archive_count_results = $count_results;
return $results;
}