'How to use ajax-load-more Wordpress plugin for search.php?

i am using Ajax-Load-More wordpress plugin for my web site but i don't understand how to use for search result in search.php

there is no code example for search.php

can any one guide me?

thanks



Solution 1:[1]

The following code should be placed inside your page template where you want Ajax Load More to display.

<?php
$term = $_GET['term'];
if(empty($term)) {
   $term = 'xxxx'; //Replace xxxx by a default term search
}      
echo do_shortcode('[ajax_load_more post_type="post, page, portfolio" search="'. $term .'" orderby="relevance" posts_per_page="4" scroll="true" css_classes="plain-text" button_label="Show More Results"]');
?>

SearchWP and Relvanssi extensions could be interesting.

(needed at least 6 chars in the edit to fix your syntax error) -dm

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 111