Thanks for the update on that code. I was looking this exact solution for custom post types.
I accidentally found the same site plus code, and was wondering if there was a better way, i hated that die() part.
Never thought of using the template_include filter…
you might have accidentally deleted a semi-colon, paranthesis, or something that might create an error.
or, if you used a prefix for the database, you might need to check this line :
$table_prefix = ‘main_’;
wordpress might be trying to duplicate the prefix while accessing the db.