Tagged: search
-
AuthorPosts
-
August 30, 2017 at 3:34 pm #845839
Hello,
I am having problems changing the text on the search page. I went into loop-search.php and tried to change this text:
<?php _e('Sorry, no posts matched your criteria. Please try another search', 'avia_framework'); ?> </p>
To this:
<?php _e('Sorry, we couldn't find what you were looking for. Please try searching again.', 'avia_framework'); ?> </p>
But when I changed it, I just got the loading screen every time I tried to search. I switched the code back and now the search is working, but I would like to change the text.
I’m also trying to figure out how to remove the text “If you are not happy with the results below please do another search” completely, but can’t find it in the loop-search.php doc.
Here is an example search page: http://mjm.flywheelsites.com/?s=fdsf
I’d appreciate your help, thanks!
August 31, 2017 at 4:14 pm #846334Hey Kirstie,
Here is a thread for you to consider
If you need further assistance please let us know.
Best regards,
VictoriaSeptember 1, 2017 at 7:01 pm #846958I added this code to my functions.php file, but am not sure what to do next:
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; }
Can you tell me where I need to go to actually edit the text? I am not very familiar with php, so I would appreciate the help! I would also like to completely remove the text “If you are not happy with the results below please do another search” under “New Search” completely. Thank you!
September 4, 2017 at 2:47 pm #847745Hi,
Please go to enfold/search.php file and remove following lines
<div class='page-heading-container clearfix'> <section class="search_form_field"> <?php echo "<h4>".__('New Search','avia_framework')."</h4>"; echo "<p>".__('If you are not happy with the results below please do another search','avia_framework')."</p>"; get_search_form(); echo "<span class='author-extra-border'></span>"; ?> </section> </div>
We would recommend you to use a child theme – http://kriesi.at/documentation/enfold/using-a-child-theme/ and apply the changes there.
Best regards,
YigitSeptember 5, 2017 at 4:48 pm #848196Thanks! That solved one of my problems of removing the text under “New Search.”
I would still like to change the text “Sorry, no posts matched your criteria. Please try another search” and “You might want to consider some of our suggestions to get better results:” I added the following code to my functions.php file as instructed, but am not sure what to do next to actually update the text. I am using a child theme.
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; }
Thank you!
September 6, 2017 at 4:32 pm #848721Hi MattJensenMarketing,
You can do something like this
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'] = __('Sorry, no posts matched your criteria. Please try another search', 'avia_framework'); return $search_messages; }
If you need further assistance please let us know.
Best regards,
VictoriaSeptember 6, 2017 at 10:48 pm #848875That changes the text on the search dropdown, but what I’m trying to change is the text on the actual search page.
Example page: http://mjm.flywheelsites.com/?s=dsfdsd
Thanks!
September 9, 2017 at 4:38 am #849806Hi,
Edit the includes > loop-search.php file, line 124:
<?php _e('Sorry, we couldn't find what you were looking for. Please try searching again.', 'avia_framework'); ?>
The code above is correct except for one thing, the single quote. Replace it with:
<?php _e("Sorry, we couldn't find what you were looking for. Please try searching again.", "avia_framework"); ?>
Best regards,
IsmaelSeptember 11, 2017 at 3:38 pm #850550That worked! Thanks, Ismael! This topic can be closed.
September 12, 2017 at 8:21 am #850847 -
AuthorPosts
- The topic ‘Change Text on Search Page’ is closed to new replies.