I got this working fine on our search page by following the guide, however we have another instance of ajax load more which is using the filters add-on. The filters include a text input, as well as taxonomy filters. Is there any way to connect the text input Search filter to this? It’s not clear based on the documentation, and I haven’t been successful with any attempts so far.
]]>I noticed an issue similar to the Fix a bug with lack of search results thread (but that post is closed to new replies). For example, using global $wp_query; echo $wp_query->found_posts;
showed that 3 results were found by WP/Relevanssi but only 2 posts were being displayed by ALM.
The code from his post didn’t work for me, but wanted to share that I realized I had sticky_posts="true"
on my shortcode (likely because I copied from a different ALM shortcode) and removing it fixed the issue. Maybe this is a bug, as I don’t think there’s anything wrong with having sticky_posts=”true” in this instance, but there ya go.
Ajax Load More is a great plugin but working with Relevanssi is not working for me.
I have installed Relevanssi plugins and it works fine to me.
Perhaps, I followed the implemented steps from https://connekthq.com/plugins/ajax-load-more/extensions/relevanssi/. And Search result does not work.
I thought it is simple…
]]>Divi pages without excerpts do not load correctly. The title and meta-data show correctly, but then the Divi shortcodes are shown. It looks like the Relevanssi “Custom search result snippets” that replace the standard excerpts, don’t get picked up.
]]>Hi
I am using Relevanssi and this filter relevanssi_hits_filter to reorder the search results by post_type, however the Ajax_load_more is nor taking this results so they are not displaying in the order I want, is there a way to reorder the post with a hook or filter in the Ajax load more?
]]>I have no idea what the cause is. Relevanssi was working fine, Ajax Load More was working fine, but combining the two caused only partial results to appear.
Debugging, the $wp_query that came back from Relevanssi had 15 posts. But Ajax Load More only showed one of them.
The solution was to make the “post__in” array use only IDs, instead of post objects.
The main cause is still unidentified.
Here is the code that solved the issue for me:
function fullest_alm_query_args_relevanssi($args){
$args = apply_filters('alm_relevanssi', $args);
if ( !empty($args['post__in']) ) {
if ( is_object($args['post__in'][0]) ) {
foreach( $args['post__in'] as $k => $v ) {
$args['post__in'][$k] = $v->ID;
}
}
}
return $args;
}
add_filter( 'alm_query_args_relevanssi', 'fullest_alm_query_args_relevanssi');
]]>
I don’t know how to contribute to the SVN repository directly so here is a fix for a common bug with this extension. If I have an empty search term, this extension breaks pagination. Note, I moved the two lines relevant to pagination outside of the inner-most if-loop.
function alm_relevanssi_get_posts($args) {
if(function_exists(‘relevanssi_do_query’)) {
$old_posts_per_page = $args[‘posts_per_page’];
$old_offset = $args[‘offset’];
$args[‘fields’] = ‘ids’;
$args[‘posts_per_page’] = -1; // We need to get all search results for this to work
$args[‘offset’] = 0; // We don’t want an offset (ALM handles this)
$query = new WP_Query($args);
relevanssi_do_query($query);
if ( ! empty( $query->posts ) ) {
$args[‘post__in’] = $query->posts; // $relevanssi_query->posts array
$args[‘orderby’] = ‘post__in’; // override orderby to relevance
$args[‘s’] = ”; // Reset ‘s’ term value
}
$args[‘posts_per_page’] = $old_posts_per_page; // Reset ‘posts_per_page’ before sending data back
$args[‘offset’] = $old_offset; // Reset ‘offset’ before sending data back
}
return $args;
}
hi Darren,
great plugin, works very well with Relevanssi!
If i buy the “Theme Repeaters” Addon for ALM, can i create a custom results template for this plugin?
thanks in advance!
andi