Forums

Relevanssi - A Better Search
Disable Highlighting of specific links on results page (3 posts)

  1. rexhaugen
    Member
    Posted 5 months ago #

    On our search results page, we have custom hyperlinks to our FAQ and contact pages. With Relevanssi, we like the highlighting of search terms in the results and when following the results links, but when you click on the custom links below the results the terms are also highlighted. Is it possible to set the hrefs to not use the Relevanssi highlighting?

    http://wordpress.org/extend/plugins/relevanssi/

  2. msaari
    Member
    Posted 5 months ago #

    Yes, you can fix that.

    The highlights are done in relevanssi_highlight_in_docs(), which is a filter on the_content hook. Unhook it and replace it with a new, more clever function.

    remove_filter('the_content', 'relevanssi_highlight_in_docs', 11);
    add_filter('the_content', 'your_relevanssi_highlight_in_docs', 11);

    Then just copy relevanssi_highlight_in_docs() as your_relevanssi_highlight_in_docs() and adjust as necessary. For example, replace the is_singular() conditional with something that checks for the pages you want to exclude.

  3. rexhaugen
    Member
    Posted 5 months ago #

    Thank you.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags