• Hi,

    I’m looking to order my posts by random. They’re filtered by category into their respective page e.g. gardening, landscapes etc and when you go on there the posts are sorted by date, but I’d really like to sort it by random, however when I try to do this the posts are duplicated. Does anyone know of any code I can try and that will still work with the earlier category sort/sort by terms?

    Thanks

    p.s. no webpage to share as its being built

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    If they’re duplicated, then it seems you might have used your own loop rather than using query_set(). Please show your code for the template you’re using for the page on which they’re displayed. Since code doesn’t show well here, please use pastebin.com or gist.github.com and give us the link.

    Thread Starter oriver

    (@oriver)

    I’ve tried the following code:

    https://hughlashbrooke.com/2013/08/22/wordpress-random-post-order-with-correct-pagination/

    Which displays the posts randomly but sadly with duplicates/repeats and missing posts e.g. if I have 80 posts, it will show 80 posts but many of them are duplicates and so it in fact misses out 20.

    Would appreciate any suggestions, thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Sort by random not working’ is closed to new replies.