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

    #818188

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

    #818612

    Hi,

    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

    #819038

    Hi,

    So it is fixed, you have no problems?

    Best regards,
    Basilis

    #821243

    Hi,

    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.

    image one

    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

    #822185

    Hi,

    The functions enfold can be called from the child theme.
    You tried it and it did not worked for you?

    Best regards,
    Basilis

    #822555

    Hi 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

    #822786

    Hi 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

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.