Adding Query to Custom Page Template

On some servers, errors in PHP code cause 500 errors. I can’t test your code right now, but since you said the error only happens when you use your new page template this is most likely.

Yes, it’s really annoying to just have a blank page and not even have a clue of what went wrong. To find the error, you can either:

  1. Make sure your PHP is configured to show errors properly

  2. Look at your PHP error log

Good luck!