Support » Plugin: Relevanssi - A Better Search » Create Custom Search Result Snippets

  • Hi Mikko
    When I was using Relevanssi 3.5.3 two years ago, Relevanssi would create a 30 word except snippet around the search term. This worked really well

    My problem is that when I search for something it brings back the whole page which is really long instead of just fetching the words around the search term

    Is there a way to get that to work again?
    If not is it possible to serve up a paragraph section which has the search term ?
    If I put anchors by all h3 tags can I get Relevanssi to bring up that particular paragrah?

    Any help would be great
    Thjanks Steve

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


    Relevanssi still works that way. It’s just your theme that is showing the full pages instead of excerpts. If you modify your theme to show excerpts, you’ll see the Relevanssi-generated excerpts.

    Your theme is likely using the_content() in the search results template to show the posts; change that to the_excerpt() and it’ll work.

    Thread Starter stevebro


    Yes thank you, that worked very well

    Is there a CSS class I can use for the search page?
    Each of the excerpts has a large space underneath.

    Can you suggest the CSS I could use for
    margin bottom: 0px;

    thank you Steve

    Plugin Author Mikko Saari


    Without seeing your site, can’t say anything that’ll definitely work. The <body> on search results pages should have classes search and search-results in most cases, though.

    You can use the browser CSS inspector to figure out a good selector for this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create Custom Search Result Snippets’ is closed to new replies.