-
AuthorPosts
-
July 7, 2017 at 12:08 pm #817789
Hi all,
How do you target the array that outputs the words on ajax search when no search results are found?
The array lives in functions-enfold.php on lines 405 to 419.I was thinking of adding
function avia_ajax_search() { $search_messages = array( 'no_criteria_matched' => __("Uh oh! That search term has no results", 'avia_framework'), 'another_search_term' => __("Let's try again", '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') ); } add_filter( 'wp_ajax_avia_ajax_search', 'avia_ajax_search' );
to childs functions.php but that seems to break the ajax results
Any pointers?
Thanks
TJ
July 8, 2017 at 4:23 pm #818188Hey TJ,
Break how? Are you getting any errors? Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaJuly 10, 2017 at 9:51 am #818612Hi,
Well it doesn’t break it as such. the search function works fine just the text disappears when no searches are found.
I haven’t actually implemented the change I’m just pondering how it’s done :)
Thanks
TJ
July 10, 2017 at 11:40 pm #819038Hi,
So it is fixed, you have no problems?
Best regards,
BasilisJuly 14, 2017 at 4:02 pm #821243Hi,
The issue isn’t fixed. To be fair it isn’t really an issue I’m just curious as to how I change something more permanently . The standard ajax search shows some generic text that I have changed to the following.
The array that was changed is in functions-enfold.php. Now when an update is done that change will be lost and I’ll have to recreate it. Is there something child-theme level i can change / add to make the permanent?
The original post I made shows a function i thought might work, but it doesn’t.
Thanks
TJ
July 16, 2017 at 9:53 pm #822185Hi,
The functions enfold can be called from the child theme.
You tried it and it did not worked for you?Best regards,
BasilisJuly 17, 2017 at 12:45 pm #822555Hi Basilis,
Correct. The entire function that controls the ajax search is over 300 lines. I didn’t want to copy / change all of that in the child theme so tried to target only the array that controlled the part i wanted to change. The code in the first post targets just that.
Rather than changing the text however, it removed all text.The question id how do I target just the array and not the entire function? Or is it not possible?
Thanks
TJ
July 17, 2017 at 5:59 pm #822786Hi TJ,
You could introduce a filter there and do whaterver you need with that filter, but again it will be wiped out by update if you don’t put it in the child theme.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.