[wp-trac] [WordPress Trac] #35326: New taxonomy template

WordPress Trac noreply at wordpress.org
Thu Jan 7 14:00:43 UTC 2016


#35326: New taxonomy template
-------------------------------------+-----------------------------
 Reporter:  sebastian.pisula         |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Taxonomy                 |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:  template
-------------------------------------+-----------------------------

Comment (by theMikeD):

 Replying to [comment:5 swissspidy]:
 > Replying to [comment:4 theMikeD]:
 > > @swissspidy since term IDs are now unique thanks to all the term
 splitting, why do we need `$taxonomy` in
 `taxonomy-$taxonomy-{$term->term_id}.php`?
 >
 > I suggested it because of consistency.
 >
 > First, there's already `taxonomy-$taxonomy-{$term->slug}.php`, so adding
 a template with the ID makes sense.

 In the case of a slug it's needed because two terms in different
 taxonomies can have the same slug. This isn't true for IDs.

 >Second, this helps developers figuring out what's going on. For example,
 `taxonomy-123.php`sounds like it's the template for a taxonomy with the ID
 123. `taxonomy-color-123.php` is more obvious.

 This is in direct opposition to how term splitting is being done,
 specifically how the taxonomy field is being stripped from term functions.
 Why the inconsistency? IMHO I think it's fair to expect developers to read
 the template docs to determine how they work without needing this type of
 hand holding.

 >
 > Finally, when the taxonomy name can be left out, `term-123.php` would
 make more sense. But again, this would not be consistent with the existing
 templates.

 If clarity is the goal, consider what we already have:
 `category-{$category->term_id}.php`
 `tag-{$tag->term_id}.php`

 Using `taxonomy-{$term->term_id}.php` or `$taxonomy-{$term->term_id}.php`
 is more consistant with the category and tag template names than
 `taxonomy-$taxonomy-{$term->term_id}.php`

 If consistency is the goal, IMHO you have two choices:
 `category-{$category->term_id}.php`
 `tag-{$tag->term_id}.php`
 `$taxonomy-{$term->term_id}.php`
 or
 `taxonomy-category-{$category->term_id}.php`
 `taxonomy-tag-{$tag->term_id}.php`
 `taxonomy-$taxonomy-{$term->term_id}.php`

 Or we can use `term-{$term->term_id}.php`, have it called after
 `category-{$category->term_id}.php`, `tag-{$tag->term_id}.php` in the
 hierarchy, and not only is this issue solved but we can look forward to
 eventually phasing out the category- and tag-specific templates and
 simplifying the hierarchy. All thanks to term splitting.

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


More information about the wp-trac mailing list