Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #457585

    Hello,

    One problem integrating relevanssi plugin:

    When I use ajax search button (in menu) and it’s integrated with relevanssi through functions.php, ajax search lists, sometimes is not good, it writes some avia code, see image:

    The code I use to integrate relevanssi with the ajax search button (from your doc):

    /*relevanssi*/
    add_filter('avf_ajax_search_function', 'avia_init_relevanssi', 10, 4);
    function avia_init_relevanssi($function_name, $search_query, $search_parameters, $defaults)
    {
        $function_name = 'avia_relevanssi_search';
        return $function_name;
    }
    
    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 = $tempquery->posts;
    
        return $posts;
    }

    Till now I’ve solved it unmarking relevanssi option

    Create custom search result snippets:
    If checked, Relevanssi will create excerpts that contain the search term hits. To make them work, make sure your search result template uses the_excerpt() to display post excerpts.

    However it’s not the best way because then I have to write excerpts and they are static (not dinamically generated in function of the search query).

    #458252

    Hi juanda99!

    Thank you for using Enfold.

    Unfortunately, the ajax search result can’t render shortcodes. You can hide the excerpt with this in the Quick CSS field:

    span.ajax_search_excerpt {
      display: none;
    }

    Or set the excerpt manually in the Excerpt box.

    Cheers!
    Ismael

    #459294

    Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Relevanssi error’ is closed to new replies.