[Support request] Random posts every time I get them

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Random posts every time I get them

Tagged: 

This topic contains 9 replies, has 2 voices, and was last updated by  Tom 1 week, 6 days ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6487

    Alberto
    Participant

    Hello.
    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.

    #6494

    Tom
    Keymaster

    Hi there,

    It should be random on each reload. Any chance you can link me to your site?

    #6506

    Alberto
    Participant

    Hi 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.

    #6515

    Tom
    Keymaster

    Ah, I believe this is because you have pagination turned on.

    WordPress has a really hard time with random orders when pagination is involved, unfortunately.

    #6521

    Alberto
    Participant

    Hi 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?

    #6522

    Tom
    Keymaster

    To access all posts without pagination? You can set the posts per page option to a high number 🙂

    #6529

    Alberto
    Participant

    Hello
    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?

    #6545

    Tom
    Keymaster

    I 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.

    #6648

    Alberto
    Participant

    Hello
    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)

    #6674

    Tom
    Keymaster

    It’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 pagination

    Getting the two to work together better might be possible with some extensive coding, but even then I’m not 100% sure it’s possible.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.