WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#35477 closed enhancement (wontfix)

archive-$post_type.php in get_taxonomy_template

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords: close
Focuses: template Cc:
PR Number:

Description

I have custom post type and archive. In archive-post_type.php I have template. But this CPT have a taxonomy. Template in taxonomy is identical to archive-post_type.php so I make taxonomy-taxonomy.php with content:

<?php

get_template_part( 'archive', 'post_type' );

But I think that WordPress should load archive-post_type.php.

Attachments (1)

35477.patch (726 bytes) - added by sebastian.pisula 4 years ago.

Download all attachments as: .zip

Change History (3)

#1 @swissspidy
4 years ago

  • Focuses template added
  • Keywords close added

archive-{$post_type}.php is already used in get_archive_template() for post type archives. Using the same template in get_taxonomy_template() would lead to unintended effects.

In get_taxonomy_template(), the post type of every post can theoretically be different, so loading a template for a specific post type associated with the taxonomy is not possible.

What you're currently doing should be fine and is not wrong.

#2 @dd32
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I'm going to close this as wontfix as I don't think core should be doing this by default - but that themes which are designed for it should by all means add a placeholder and include the template it wants to share.

Note: See TracTickets for help on using tickets.