Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #671236

    Hello Enfold,

    Thanks for your fantastic theme. I use relevanssi instead of the default WordPress default search engine as described here: I have a few questions about the search results presentation.

    1. AJAX search display the pagebuilder code. If possible I would like to show highlighted text with search word here or it this is not possible the exerpt. How do I fix this?

    2. How do I exclude ‘avia button text’ from indexing and search results?

    Best regards,

    Lennart

    #671332

    Hi lenvo!

    Please go to Appearance > Editor and edit functions-enfold.php file and find

    $output .= $search_messages['another_search_term'];

    and change it to

    $output .= do_shortcode($search_messages['another_search_term']);

    Best regards,
    Yigit

    #674647

    Thanks for your reply Yigit ! Unfortunately, the problems have not been solved . I have been able to hide the buttons text of the search results page by converting them into widgets ( and exclude). However, still not all the shortcode stripped from my search results. See below for an example of visible shortcode content in serach results from Easy Slider pagination. How do I fix this so all shortcodes are stripped?

    My second question is about the ajax functionality. I’m still not managed to replace the shortcodes for highlighted text without shortcodes displayed. I’ve tried your solution but this did not work for me. Is this not a common problem when replacing default search by Relevanssi? I’m not sure if so, but I guess I have to customize AJAX functionality as seen below. Do you have a solution to strip the shortcodes from AJAX search?

    null

    Front-end:

    Thanks in advance for your help. Looking forward for your answers.

    • This reply was modified 8 years, 4 months ago by lenvo. Reason: Added image front-end AJAX functionality
    #676127

    Hi,

    Another workaround is to edit the pages and add a custom excerpt or summary to it. The ajax search will display this text instead of the builder content.

    Best regards,
    Ismael

    #676323

    Hello Ismael,

    1. I would like to show highlight content instead of the page excerpt. As you can see in the first image of my last post not all shortcodes are stripped. How do I fix this?

    2. I’ve edited the excerpt function for ‘AJAX live search’ in functions-enfold.php as you can see below. The excerpt of the page is now shown in live search. But how do I show content like on my resultpage without shortcodes instead?

     $excerpt = trim(get_the_excerpt());
    
    	            if(!empty($post->post_excerpt))
    	            {					
    					$excerpt = apply_filters( 'the_excerpt', get_the_excerpt( $post->ID ), $post>post_excerpt,70," ","...", true, '', true );
    	                 //$excerpt =  apply_filters( 'avf_ajax_search_excerpt', avia_backend_truncate($post->post_excerpt,70," ","...", true, '', true) );
    	            }
    	            else
    	            {
    					$excerpt = apply_filters( 'the_excerpt', get_the_excerpt( $post->ID ), $post>post_excerpt,70," ","...", true, '', true );
    	                 //$excerpt = apply_filters( 'avf_ajax_search_no_excerpt', get_the_time($search_messages['time_format'], $post->ID), $post );
    	            }

    Looking forward for your reply.

    Best regards,

    Lennart

    #676328

    One more question about live search:

    3. I tried the code below for functions.php to limit ajax live search results when using relevanssi but not any of them work for me. How do I limit ajax search results using relevanssi?

    Not working on my website:

    add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1);
    function avf_modify_ajax_search_query($search_parameters)
    {
    parse_str($search_parameters, $params);
    $params['numberposts'] = 3;
    $search_parameters = http_build_query($params);
    return $search_parameters;
    }
    #678032

    Hi Enfold!

    Any suggestions? Here is the update to my questions:

    1. How do I limit ajax search results with Relevanssi? The following code did not work for me:

     add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1);
    function avf_modify_ajax_search_query($search_parameters)
    {
    parse_str($search_parameters, $params);
    $params['numberposts'] = 3;
    $search_parameters = http_build_query($params);
    return $search_parameters;
    }

    2. As I told the ‘easy slider’ shortcode was not fully stripped. So my search results returned ‘Previous Next 1 2 3 4 5’ (depending on how much slided). I fixed this with the following code in functions.php

    add_filter('relevanssi_pre_excerpt_content', 'rlv_remove_flipbook');
    function rlv_remove_flipbook($content) {
     $content = preg_replace('/\[\/av_slideshow]/', '', $content);
     return $content;
    }

    3. I changed code in enfold-functions.php so my ajax results show the except. If possible I still would like to show highlight page content here as on my search result page. Is this possible?

    Thanks in advance for the support!

    #678569

    Hi,

    1.) Replace the avia_relevanssi_search function with the following:

    function avia_relevanssi_search($search_query, $search_parameters, $defaults)
    {
        global $query;
        $tempquery = $query;
        if(empty($tempquery)) $tempquery = new WP_Query();
        $search_parameters['numberposts'] = 3;
        $tempquery->query_vars = $search_parameters;
        relevanssi_do_query($tempquery);
        $posts = $tempquery->posts;
    
        return $posts;
    }

    3.) I’m sorry but what do you mean by “highlight page content”?

    Best regards,
    Ismael

    #845826

    Hi @Ismael,
    i use the relevanssi plugin as well and have the same problem with the limitation of the ajax search on main page.
    DEV-environment to a clients page
    (Search is in burger menu)

    if you search for example “matratzen” (german for mattresses) you get almost 30 results.
    I tried your code “avia_relevanssi_search function” but no change.

    is there a another way to resolve this problem.

    best regards
    Ruben

    #846719

    Hi,

    Replace the code with:

    function avia_relevanssi_search($search_query, $search_parameters, $defaults)
    {
        global $query;
        $tempquery = $query;
        if(empty($tempquery)) $tempquery = new WP_Query();
        $tempquery->query_vars = $search_parameters;
        relevanssi_do_query($tempquery);
        $posts = array_slice($tempquery->posts, 0, 5);
    
        return $posts;
    }

    Limit the post by adjusting the value on this line.

    $posts = array_slice($tempquery->posts, 0, 5);
    

    Default is 5.

    Best regards,
    Ismael

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