Why would a completely normal loop give offset errors and maximum execution time errors?

I finally figured this out. It’s simple, too.

As I posted it, that loop would never finish because there’s nothing advancing the counter inside the while loop.

But if I uncomment my fairly normal-looking code and run it, it still wouldn’t close, because I’m not advancing the specific Query object’s counter. When you run the_post(), it advances the counter inside the global loop object and sets the global $post object, which is what will be run when you call functions like the_title() and others. So you’d run through every post in the database, because though my custom $home_gallery query object only had 5 posts, the global loop has all the posts in it.

In other words, since I didn’t specifically run $home_gallery->the_post();, everything exploded.

Hope this helps someone else.