Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Please show me your search results template. It’s usually the search.php file in your theme folder. Put it in a Pastebin and share the link here.

    Thread Starter Neeznoodle1

    (@neeznoodle1)

    There is no search.php file for my theme (Divi). The search function is in the index.php file, which I’ve included a link to below.

    https://pastebin.com/zQKKwrjt

    Plugin Author Mikko Saari

    (@msaari)

    Try replacing

    truncate_post( 270 );

    with

    if (is_search()) { the_excerpt(); }?else { truncate_post( 270 ); }

    Thread Starter Neeznoodle1

    (@neeznoodle1)

    That worked. Thank you!

    This worked for me too. Thanks!

    +1 worked for me, thank you Mikko.

    I’ve submitted a Theme Suggestion to Elegant Themes to see if they can do anything to make this work out of the box without requiring customization, since they recommend Relevanssi in a blog post.

    I’m having the same problem with Enfold theme. Its search.php file is here:

    https://pastebin.com/nzZC228R

    And there are also a few functions added:

    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;
    }

    Any help would be greatly appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Snippets and highlighting isn't working’ is closed to new replies.