fixed broken custom post type display
better fix for bbpress and custom post types
lots of refactoring