Skip to content

Instantly share code, notes, and snippets.

Last active May 22, 2019
What would you like to do?
SearchWP and Ajax Load More
Use alm_query_args filter to pass data to SearchWP.
function my_alm_query_args_searchwp($args){
$engine = 'default';
$args = apply_filters('alm_searchwp', $args, $engine);
return $args;
add_filter( 'alm_query_args_searchwp', 'my_alm_query_args_searchwp');
Template Name: Search Results Template
Custom WP search results template. Get value of querystring and pass value to Ajax Load More
$term = (isset($_GET['term'])) ? $_GET['term'] : ''; // get querystring param
// Add Ajax Load More shortcode with a unique ID parameter.
echo do_shortcode('[ajax_load_more id="searchwp" search="'. $term .'" post_type="any"]');
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment