There should be index pages for custom post types
|Reported by:||frankieroberto||Owned by:||nacin|
|Cc:||yeswework, eric@…, mikeschinkel@…, louyx, jer@…, laffaire, alexdunae, aaroncampbell, lance@…, azizur, johnbillion@…, piemanek@…, binarybit, deepak.seth, Ken@…, Seags, sirzooro|
Currently, if you create a custom post type, and have rewrites enabled, it will generate posts with URLs along the lines of /post-type/post-name. However, if you try to access an index page at the obvious URL of /post-type you'll get a 404, as Wordpress will try to find a page with that slug.
Whilst it's possible to manually create a page with that slug name, and then use a custom template to generate a query bringing back the most recent posts with a set post-type, it'd be useful if this was built-in (and I suspect it'd be the expected behaviour).
Suggested function to use would be is_post_type() which uses the template post-type-slug.php falling back to archive.php if that's not present.
Change History (76)
- Cc yeswework added
- Component changed from General to Template
- Milestone changed from Unassigned to 3.0
- Priority changed from normal to high
- Version set to 3.0
comment:19 scribu — 3 years ago
- Keywords needs-patch added
- Milestone changed from Future Release to 3.1
comment:20 nacin — 3 years ago
- Owner set to nacin
- Status changed from new to accepted
- Type changed from enhancement to task (blessed)
comment:55 follow-up: ↓ 56 binarybit — 3 years ago
- Cc binarybit added
- Version changed from 3.0 to 3.1