Opened 4 years ago
Last modified 4 years ago
#57390 new defect (bug)
[ wp-includes/template.php - get_archive_template() ] - archive for post doesn't load the correct template
| Reported by: | riccardodicurti | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Themes | Version: | 1.5 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: |
Description
Good morning everyone, while making templates for the post-type 'post' I discovered that:
The get_archive_template() function ( in wp-includes/template.php line 150 ) for a post archive returns archive.php instead of archive-post.php while the get_single_template() function for a post returns single-post.php.
In my opinion, the two results don't agree each other and the first function should work for posts as well.
Thanks in advance.
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The get_archive_template() function retrieves the path to the archive template file for the current query. This function displays a list of posts on an archive page, such as a blog homepage or a category page. The function first checks if only one post type is being queried for, and if so, it tries to find a template specific to that post type. For example, if the post type is 'post', it will try to find a template named 'archive-post.php'. The function returns to the default 'archive.php' template if no such template is found. This behavior is intentional, I believe, and is designed to allow theme developers to create specific templates for different post types if needed. For example, a theme might want to display posts in a different way on the archive page, depending on the post type.