• There is an issue in Search Results highlighing feature. I have two different templates:

    1) The one is Search Results page which display the listing of Search results by showing Post Title and Post Exceprt with a link to that page. In it the highlighting for titles works fine.

    2) The second is a diferent template and it will display the complete page content. On that page the Titles are not highlighted.

    In adminsitration section of Relevanssi, I have checked the option ‘Highlight in titles’.

    Can you please guide why this issue araises and why titles are not highlighted. In my second template I have even deleted all section and just print “relevanssi_the_title()” but it only prints TITLE without highlighting.,

    Thanks

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

    (@msaari)

    relevanssi_the_title() only highlights the title on the search results page, it doesn’t work on the actual page. It doesn’t know what to highlight –?the highlights only exist on the search results page when Relevanssi knows what the search keyword is (and Relevanssi is active in the first place; on the actual post page, Relevanssi doesn’t even run at all).

    Thread Starter tariqaltaf

    (@tariqaltaf)

    ok thanks for the explanation.
    On my search result page if I open any link then the page opens with that type of url:
    https://www.abc.com/mypage?highlight=product
    And on that page the keyword ‘Product’ is highlighted where ever it is.
    But on the same page if my Heading contains the searched keyword which is ‘Product’ then it cannot highlight it.

    Means content is highlighted but heading is not highlighted.
    This is my issue.

    Plugin Author Mikko Saari

    (@msaari)

    If you want to highlight the title on the post page (generally, not a big deal, because people are going to notice the title anyway, so the highlight doesn’t give much extra benefit there), you can do that by passing the title through relevanssi_highlight_terms() function. See here: https://www.relevanssi.com/user-manual/functions/#relevanssi_highlight_terms

    Thread Starter tariqaltaf

    (@tariqaltaf)

    This function takes two parameters, whereas I want to just highlight the_title(). Can you guide how to use this function to highlight Title?

    Plugin Author Mikko Saari

    (@msaari)

    Yes, you need two parameters: one contains the title you want to highlight, and the other contains the words that need to be highlighted. So, you’d use it like this, for example:

    <h2><?php echo relevanssi_highlight_terms( get_the_title(), $_GET['highlight'] ); ?></h2>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Title Highlighting Issue’ is closed to new replies.