[wp-trac] [WordPress Trac] #57390: [ wp-includes/template.php - get_archive_template() ] - archive for post doesn't load the correct template

WordPress Trac noreply at wordpress.org
Wed Dec 28 09:59:46 UTC 2022


#57390: [ wp-includes/template.php - get_archive_template() ] - archive for post
doesn't load the correct template
-----------------------------+------------------------------
 Reporter:  riccardodicurti  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Themes           |     Version:  1.5
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+------------------------------

Comment (by rajinsharwar):

 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57390#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list