I have the same issue. Also, it removes some posts to be shown.
I assume, after the load more feature has been triggered, some posts will be shown again (duplicated) instead of showing the remaining posts that have not been rendered yet.
Working on a fix but you can alter the query using this method:
https://developers.elementor.com/custom-query-filter/
And you can filter the posts that are shown.
Also are there more then one posts widgets on page?
Would you mind elaborate on this? Her is what I did but not working. Please let me know how to make it work:
Snippet:
// Showing multiple post types in Posts Widget
add_action( ‘elementor/query/my_custom_filter’, function( $query ) {
// Here we set the query to fetch posts with
// post type of ‘custom-post-type1’ and ‘custom-post-type2’
$query->set( ‘post_type’, [ ‘post’ ] );
} );
and under Edit Post > Query > Query ID I put this:
my_custom_filter
Is that right?
thanks
-
This reply was modified 5 years, 6 months ago by
esalari.
Also, is it possible to remove the change in the URL for pagination? In other words, when the user scrolls down, the URL changes from mysite.com/ to mysite.com/page/1/ and mysite.com/page/2/ and so on. This can cause some issues when users refreshes the page and the user will see a 404-page error. So, it would be great to disable page URL change/update on the scroll.
Thanks
Also tried this in my Child Theme with no luck:
add_action(‘elementor/query/my_custom_filter’, function($query){
$query -> set(‘order’, ‘random’);
});
you can use this custom query filter hook:
// Adding a custom filter to post widget
add_action( 'elementor/query/uniq_rand', function( $query ) {
// Here we set the query
if($query->query['paged']==1 || !isset($_SESSION['rand_seed'])) {
$_SESSION['rand_seed'] = rand();
}
$query->set( 'orderby','RAND('.$_SESSION['rand_seed'].')' );
} );
In Posts Widget in Custom Query ID you set: uniq_rand .
Also make sure you have this line on the top of the functions.php for this hook to work: session_start();