Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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!

    #846334

    Hey Kirstie,

    Here is a thread for you to consider

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #846958

    I 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!

    #847745

    Hi,

    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,
    Yigit

    #848196

    Thanks! 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!

    #848721

    Hi 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,
    Victoria

    #848875

    That 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!

    #849806

    Hi,

    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,
    Ismael

    #850550

    That worked! Thanks, Ismael! This topic can be closed.

    #850847

    Hi,

    Alright. Please feel free to open a new thread if you need anything else.

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Change Text on Search Page’ is closed to new replies.