I’ve recently combined my WordPress custom post types into a single loop on my homepage. The code to do this was fairly trivial and well documented.
However, using the above function by itself caused a problem with pagination. Basically, the pagination routine did not seem to be aware that I was combining my custom post types and only counted regular posts. This meant that if I paged past the number of regular posts, I would hit a 404 error. To fix this, I’ve included the following function in my theme’s functions.php file.
The function tests for paging and whether or not the custom post type is set. If paging is set and the custom post type is not set, it will push a value into the query string to force the loop to count all post types. I’m not sure if anyone else will find this useful, but I thought I should post it.