• I’m trying to randomize the order of posts for the current day such that users see a different set of posts uploaded on the same day when the site loads each time. I don’t want this to affect the older posts though, they need to be sorted in the default way (by upload date). Do I need to use a plugin or is there a snippet of code that can be used to achieve this? Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you want both the current day posts and older post to show on the same page you would need to create a double loop. The first loop would only show the current day posts and randomize them, the second loop would show the rest. I think this would be the best way to do it.

    Thread Starter prajwalkvr

    (@prajwalkvr)

    Thanks for your reply Joe. I don’t need to display both current and older posts on the same page. I want to display all the current posts randomly in the first page followed by all the older posts in the remaining pages. Would I still have to use two loops?

    Thread Starter prajwalkvr

    (@prajwalkvr)

    Can someone please help me with this?

    Is there any way you can show me where you are trying to put this? Do you want for example Home Page (Current Day Posts) Blog Page (All Other Posts) or are you trying to have a Blog page with pagination?

    I am trying to fully understand what you are looking to do so I may provide the proper advice and direction. Cheers!

    Thread Starter prajwalkvr

    (@prajwalkvr)

    Thanks for your reply John. All I’m trying to do is display the current day’s posts in a random order on the home page each time the website is opened. The older posts (posts older than the current day) – displayed in consequent pages using pagination – are displayed after the current day’s posts in the order of their upload date. Please let me know if you need any additional information.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to randomize posts for current day while leaving the older posts untouched’ is closed to new replies.