How to Highlight the Search Terms in Results in WordPress


How to Highlight the Search Terms in Results in WordPress
Marianne Foster

In an attempt to make your WordPress search even more user friendly, you can highlight the search terms in the results. We did this for one of our clients, so we thought it would be useful for other users. In this article we will show you how you can highlight search terms in the results in WordPress.

WordPress.org
Flavia Woodworth

II. In most up to date themes (including WP’s own Default theme) post and page content is shown inside a div with class hentry.
This class is recognized by the hilite script, which means search terms found in post and page content will be highlighted but not similar terms that coïncidentaly reside in the page header, sidebar or footer.
If your current theme does not use the hentry class (yet), this plugin will look for IDs content, main and finally wrapper (which might include the header, sidebar and footer areas) but if none of those are found, it will not work for you out of the box.
See the last of the FAQ’s for ways to make it work.

Highlight searched terms in WordPress search results
Joann Townsend

You can make your WordPress blog more user friendly by highlighting the search terms on Search page when user searches for something. By default WordPress search template is designed to show only the page title and excerpt. Unless and until the theme provides this feature out of the box, the searched terms are not highlighted in search results. There are many free plugins available on wordpress.org that will do this job for you. However you can do this on your own too. It will require not more than 15 to 20 line of code to achieve this. We did it recently for one of our clients and I thought why not share it on my blog. So below is the code. Simple copy and save it to your active theme’s functions.php. You don’t require anything more apart from it!

How to Customize Search Page Results in WordPress
Cherelle Delossantos

You want to make sure every single page of your site is working hard for you – even the search results pages. While most readers may be interested in your home page or core offerings, they probably come to your site looking for something specific. Although your site is likely not a search engine, it’s best to provide the help and functionality visitors are accustom to. You never know how a single page can affect individual users. Present the right visitor with the right information at the right time and you stand to not only keep that visitor on your site for longer but also turn them into a loyal customer.

Be the first to comment

Leave a Reply

Your email address will not be published.


*