Home › Forums › Pro Support › Random posts every time I get them
Tagged: random order
- This topic has 9 replies, 2 voices, and was last updated 4 years, 10 months ago by
Tom.
-
AuthorPosts
-
November 20, 2018 at 2:21 am #6487
Alberto
ParticipantHello.
This is about random post option in More Settings > Order by
It seems once I setup this option to display the posts randomly they are displayed always in the same order, i.e., no matter if I reload (or visit) the page several times because the order is always the same.
What I need is a random order each time I visit the page (or reload it).
What can I do to achieve this?Regards.
November 20, 2018 at 5:22 pm #6494Tom
KeymasterHi there,
It should be random on each reload. Any chance you can link me to your site?
November 21, 2018 at 10:11 am #6506Alberto
ParticipantHi Tom.
That’s what I expected from the plugin.
Sure, you can visit https://traduccioneschino.es/listado-locuciones/ It’s random order but is always the same.I look forward your answer.
November 21, 2018 at 1:37 pm #6515Tom
KeymasterAh, I believe this is because you have pagination turned on.
WordPress has a really hard time with random orders when pagination is involved, unfortunately.
November 22, 2018 at 10:39 am #6521Alberto
ParticipantHi Tom.
That’s right, if I turn off pagination then the random order works fine.
So what do I have to do to be able to access all posts anyway?November 22, 2018 at 7:00 pm #6522Tom
KeymasterTo access all posts without pagination? You can set the posts per page option to a high number 🙂
November 23, 2018 at 2:51 am #6529Alberto
ParticipantHello
No, no to access all post without paginatio, WITH pagination. What if I have 200 posts?, I manage without pagination or I manage without an option of the plugin that I need?November 23, 2018 at 8:37 pm #6545Tom
KeymasterI don’t believe it’s possible to have random posts on every load along with pagination. If that was the case, the posts would randomize when you went to the second/third etc.. pages, and you’d see posts you’ve already gone through.
Instead, WPSP caches the random order in a session so you can paginate through the posts without any duplication.
November 26, 2018 at 10:00 am #6648Alberto
ParticipantHello
What I understand is that there would be a query of all the posts, they would be randomly sorted and then displayed on the different pages.
The posts seen on the first page do not become sorted when turning pages, but the following ones are shown according to the order that has already been established in the query.What should I do to use your plugin with a random order that changes if I clear the browser cache? (And using pagination, of course)
November 26, 2018 at 8:42 pm #6674Tom
KeymasterIt’s not browser cache – it uses PHP sessions which clear automatically when your server decides.
In this case, it’s better to either:
a) Turn off random order
b) Turn off paginationGetting the two to work together better might be possible with some extensive coding, but even then I’m not 100% sure it’s possible.
-
AuthorPosts
- You must be logged in to reply to this topic.