Learning to Never Use query_posts

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:

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.

Posted in Blog • October 4, 2019 | No Comments »

Leave a Reply

Deborah J Designs