The Relevanssi extension provides additional functionality for returning Relevanssi search results to Ajax Load More.

This extension is available for users running Ajax Load More 2.13+ and Relevanssi.


How It Works

The extension works by providing a connection point between Ajax Load More and Relevanssi.

By utilizing the core alm_query_args filter, we are able pass search parameters from a WordPress template to the relevanssi_do_query() function for results and then send those results back to Ajax Load More for display.

Implementation Steps

Step 1: Add Filter

Add the following Ajax Load More filter to your functions.php file – this filter will hook directly into the Relevanssi extension for search results.

Step 2: Template and Shortcode

In search.php or a custom template, create a shortcode with unique ID and pass the search term to Ajax Load More using the search parameter.

Pro Tip: Don’t forget to set your post types. Relevanssi will NOT accept post_type=”any”.


FAQs

To highlight the current search term you need to replace the_excerpt() function in your Ajax Load More Repeater Template with relevanssi_do_excerpt() and pass in the term and $post object as shown below.