Consolidate custom post type code; fixes #28