I found this code on your support site, and works just fine, BUT it also pulls PAGES on the query … Is there any chance to pull only posts ??
//——————————
// php – Display random post
//——————————
add_filter(‘avia_post_slide_query’, ‘enfold_customization_query_custom’);
function enfold_customization_query_custom( $query ) {
$query[‘orderby’] = ‘rand’;
return $query;
}
Thanks a lot !!
Luis
Hey LUISCANAL,
Please try the code like this:
add_filter('avia_post_slide_query', 'enfold_customization_query_custom');
function enfold_customization_query_custom( $query ) {
if (is_page()) return $query;
$query['orderby'] = 'rand';
return $query;
}
If you need further assistance please let us know.
Best regards,
Victoria
Unfortunely It did not worked, now brings always the same two posts instead of random ones …
Hi LUISCANAL,
How many posts do you have? What kind of caching are you using?
Best regards,
Victoria
Hi Victoria, 197 posts, cache level 0.
Hi LUISCANAL,
I tested this code and it works fine and it doesn’t fetch pages if you only selected posts or category of posts:
add_filter('avia_post_slide_query', 'enfold_customization_query_custom');
function enfold_customization_query_custom( $query ) {
$query['orderby'] = 'rand';
return $query;
}
Can you give us a link to the page mentioned and give us temporary admin access? so we can check on it further.
Just post the details in private content.
Best regards,
Nikko