#12385 closed defect (bug) (worksforme)
it's unclear which template file is used by custom post types
| Reported by: | danielpataki | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Template | Version: | 3.0 |
| Severity: | major | Keywords: | |
| Cc: | Focuses: |
Description
Hello! I'm not sure this is a problem, it's more a case of bad usage practices on my end, but perhaps something that count be addressed.
I'm using post_types to create sections on a blog. For example, you could create a Yahoo Answers type forum by creating a post type named "questions". I named it in the plural because I want to have a nice permalink style, so I created a page named "questions" and some sub-pages like "most-recent", "most-commented".
In this case however, the template pages used by wordpress are a bit mixed up. page.php is used to display the main section page, which is blogurl.com/questions/ , single.php is used to show a question single post, blogurl.com/questions/the-title-here, but for subpages, index.php is used, while it should be page.php.
I did not check how the function works, but I am guessing that since there is a post_type named "questions", wordpress assumes that "most-viewed" is a post as well. When it doesn't find it, it falls back on index.php.
Again, I think this is probably not good practice, I'm just bringing this to attention so maybe I can help a bit.
Change History (5)
#1
@
16 years ago
- Component General → Template
- Milestone Unassigned → 3.0
- Severity normal → major
- Summary post type and page name problems → it's unclear which template file is used by custom post types
- Type feature request → defect (bug)
- Version → 3.0
#3
@
16 years ago
Wow, I may have actually contributed :) Thanks for phrasing it better. and I think ticket:12105 does cover this more concisely.
Thanks!
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Rephrasing this a little bit:
It's unclear which template file is used by custom post types, and how to override them.
Suggestion: we use a file named after the post type (e.g. "custom-type.php", for one whose type is "custom_type").