Need help with a code for random posts with pagination, custom query. Problems so far; duplicates, PHP errors, missing posts, divide by categories

Question

I have category pages and a homepage showing all posts. I want to display the posts by random order so that all users have a chance to be seen – not just the latest published users. I have tried multiple different codes – problem is I keep thinking it’s fixed only to find the code causes a new error elsewhere.

1st Code – random posts but only on new window, and due to open session start caused critical warning messages.

2nd Code – randomised with refresh, new tab, window etc, but kept a set order of categories, so that on the homepage it would go books, film, TV, music etc, rather than mixing all the categories together on the homepage.

3rd Code – If you clicked on a post while pagination hadn’t completed and then went back, it duplicated posts from the earlier pagination. For example if you clicked on a post in the 2nd set of posts loaded from pagination, it would repeat posts loaded in the 1st and 2nd set for all future sets.

I’m using the plugin addon UAEL for the display of posts, its layout works best for those with accessibility difficulties – which is who I hope to mainly help (its a not-for-profit site). So can’t change plugin. Their built in order by random causes duplicates and missing posts on pagination, something that after chasing for months they say can’t be fixed. Each of the codes above did work with the plugin, but as mentioned caused errors elsewhere. Please could someone help?? Happy to try any code people can suggestion.

0
Phil 1 month 2022-07-08T20:11:47-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse