Tagged: search
Please advise on how to add custom search messages to my child theme – functions file rather than editing the functions-enfold or loop-search files.
Thanks
Hi xyzb!
Thank you for coming back.
In functions.php (child or parent theme) add the following:
add_filter('avf_ajax_search_messages', 'my_search_text', 10,2);
function my_search_text ($search_messages, $search_query)
{
// possible values to change:
//
// $search_messages = array(
// 'no_criteria_matched' => __("Sorry, no posts matched your criteria", 'avia_framework'),
// 'another_search_term' => __("Please try another search term", 'avia_framework'),
// 'time_format' => get_option('date_format'),
// 'all_results_query' => http_build_query($_REQUEST),
// 'all_results_link' => home_url('?' . http_build_query($_REQUEST)),
// 'view_all_results' => __('View all results','avia_framework')
// );
$search_messages ['no_criteria_matched'] = 'your message text to replace';
return $search_messages;
}
Enter a line for each message to replace.
Cheers!
Günter