BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 40
    Rudder on in reply to: [Resolved] Randomise Posts #7302

    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
    }

  • Participant
    Level: Enlightened
    Posts: 40
    Rudder on in reply to: [Resolved] Randomise Posts #7300

    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
    }

  • Participant
    Level: Enlightened
    Posts: 40
    Rudder on in reply to: [Resolved] Randomise Posts #7297

    Thank you Brajesh,
    I will add that now 🙂

  • Participant
    Level: Enlightened
    Posts: 40
    Rudder on in reply to: [Resolved] Media in comments #7277

    Hi Brajesh,

    I did send you a couple of emails, Did you receive them?

  • Participant
    Level: Enlightened
    Posts: 40
    Rudder on in reply to: [Resolved] Media in comments #7275

    Thank you Brajesh 🙂

  • Participant
    Level: Enlightened
    Posts: 40
    Rudder on in reply to: [Resolved] Media in comments #7247

    Yeah I think that would be perfect, Just the one image should do. 🙂