Relevanssi is a WordPress search plugin which provides a ton of configurable options like showing the search results sorted in the order of relevance, automatic bolding of the search term, ability to exclude and include categories, tags, posts and pages from search.
In this tutorial, we shall create a search template file in Genesis in which we replace the default loop
with a custom one to add support for Relevanssi.
In the custom loop's function, we shall
- get the search term entered by user
- create a WP_Query object in which the above search term and pagination info are passed as arguments
- pass the above WP_Query object to Relevanssi
- run the genesis loop
Screenshot of http://example.com/?s=lorem:
Step 1
Install and activate Relevanssi.
Step 2
Create a file named search.php in your child theme's directory having the following:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.