Replies
EDIT:
I forgot to make sure it knew it’s for posts, The way I had it then pages were randomised to, very annoying when you’re trying to find a page lol
add_action('pre_get_posts','randomize_query');
function randomize_query($query){
if ($query->have_posts()) //Check that you have posts and now knows it's for posts
$query->set('orderby', 'rand'); //Set the order to random
}
Hi brajesh,
I created a function for use in the bp-custom and it works well,
Thank you for the input 🙂
I’ve added the code below just incease someone else wants to do the same.
Ben
add_action('pre_get_posts','randomize_query');
function randomize_query($query){
if ($query->set('orderby', 'rand')); //Set the order to random
}
Thank you Brajesh,
I will add that now 🙂Hi Brajesh,
I did send you a couple of emails, Did you receive them?
Thank you Brajesh 🙂
Yeah I think that would be perfect, Just the one image should do. 🙂