Extenuating circumstances have lit a fire under my bum to get this new portfolio reasonably usable. That involved a few things:
- putting infinite scroll on the back burner – that’s going to take some serious time to figure out, if ever my brain can do such a thing
- electing to use pagination, which apparently gets busted when you use
query_posts
, which apparently one should never do
So I waded through a variety of articles that helped me piecemeal the proper code together. Here they are:
- https://www.billerickson.net/customize-the-wordpress-query/ This guy was SUPER helpful in explaining the why behind all the gobblygook of modifying the main WordPress query.
- https://remicorson.com/modifying-the-current-query-with-pre_get_posts/ For those (like me) who don’t do this often enough to remember syntax, this had helpful syntax examples.
- https://www.billerickson.net/code/wp_query-arguments/ This had a helpful list of parameters to modify the main query even further to do what I wanted it to do.
- https://developer.wordpress.org/reference/hooks/pre_get_posts/ Can’t neglect the good ol’ codex. This also had helpful syntax and examples to help me mush my own stuff together.
And thus, I jumped in my chair when things started to work. We are at least live and shareable now. Meanwhile, we are faced with the mild issue of repeat posts showing up across randomized and paginated results. The same problem this person was having.
So, small mercy that it’s not just me being a dunce and that it’s an actual issue created by randomizing not playing well with pagination. We’ll tackle this a bit later when I’ve taken a brain break.
Later:
Tried a few versions of creating a session to store the randomized order, and this is the one that worked. And thus, StackExchange saves my hide yet again.
Leave a Reply
You must be logged in to post a comment.