• Resolved Tamsin Carter

    (@tamsin-carter)


    My search results are showing \n\n within the search results content. It seems to come from places where there are headings and image buttons in the content.

    The pages are built using the Cornerstone page builder with ThemeCo’s Pro theme.

    I have used manual excerpts but this happens when the search result is quoting the relevant part of the content so the excerpt is not being used.

    I hope you can help as I have spent time getting this search facility set up and would really like to resolve this snag.

    Thank you

    Tamsin

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Tamsin Carter

    (@tamsin-carter)

    See screenshot of search result and \n\n appearing.

    Plugin Author Mikko Saari

    (@msaari)

    There’s something in your post content that causes the line feed encoding go wonky when Relevanssi generates the excerpts. These line feeds should just disappear. I can’t see any particular reason for this on the Stannah Stairlifts page source code.

    Relevanssi has good filter hooks you can probably use to fix this. Try this:

    add_filter( 'relevanssi_excerpt', function( $excerpt ) {
    return str_replace( '\n', ' ', $excerpt );
    } );

    Add this to your theme functions.php or in a code snippet. Does this fix the problem?

    Thread Starter Tamsin Carter

    (@tamsin-carter)

    Yes that fixed the problem. Thank you so much :))

    Tamsin

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