WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

#16375 closed enhancement (maybelater)

is_tax() and get_taxonomy_template() support for post formats

Reported by: nacin Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

Two things it seemed we forgot.

Currently you'd need to use is_tax() as a conditional tag for post formats. This is ugly, as it looks like this:

is_tax('post_format', 'post-format-aside');

Ideally, that slug should be internal. So we need a is_post_format() conditional tag. That's probably a lame name (most is_* functions are ambigious), and perhaps someone has a better idea.

Additionally, get_taxonomy_template() currently looks for taxonomy-$taxonomy-$term.php. That turns into taxonomy-post_format-post-format-aside.php. A simple check can allow us to instead (or in addition to) look for taxonomy-post_format-aside.php.

Change History (6)

comment:1 garyc403 years ago

Is there any particular reason why the template file name has to be "taxonomy-post_format-aside.php"? What if we support something like "post-format-aside.php" or "post_format-aside.php"?

comment:2 nacin3 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

comment:3 nacin3 years ago

We already have a nice namespace here, so we should leverage it. Also, some have recommended get_template_part( 'post-format', 'aside' ), and that would conflict. Better to avoid that by sticking to the existing namespaces.

comment:4 mikeschinkel3 years ago

  • Cc mikeschinkel@… added

comment:5 avryl8 months ago

  • Component changed from General to Taxonomy

comment:6 wonderboymusic8 months ago

  • Keywords needs-patch added; 2nd-opinion removed
  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Seems like has_post_format() theme hint is the pattern to check inside the template these days, or use taxonomy-post_format.php and single.php with get_template_part( 'content', get_post_format() )

Note: See TracTickets for help on using tickets.