WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#15017 closed defect (bug) (fixed)

get_body_class() doesn't return information about the current custom taxonomy archive

Reported by: nkuttler Owned by: nkuttler
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch, ui-feedback
Focuses: Cc:

Description

Custom taxonomy archives don't get a body class added. Patch attached.

Attachments (4)

body_class_tax.diff (619 bytes) - added by nkuttler 4 years ago.
Trivial patch
body_class_tax2.diff (665 bytes) - added by nkuttler 4 years ago.
body_class_tax2.2.diff (656 bytes) - added by nkuttler 4 years ago.
body_class_tax.trunk.diff (684 bytes) - added by nkuttler 4 years ago.

Download all attachments as: .zip

Change History (12)

nkuttler4 years ago

Trivial patch

comment:1 nkuttler4 years ago

The first patch was flawed. The second one adds

tax-$taxonomy and
tax-$taxonomy-$term

which makes this usable.

nkuttler4 years ago

comment:2 hakre4 years ago

why not <body class="... tax-$taxonomy term-$term ...">?

that would save the $taxonomy duplication and both can be combined in css selectors by concatenation (body.tax-$taxonomy.term-$term). Additionally, from a styling perspective the same term can be addressed across taxonomies

comment:3 nkuttler4 years ago

Sounds perfect. tax-$taxonomy-$term is cumbersome indeed.

nkuttler4 years ago

comment:4 nkuttler4 years ago

  • Keywords ui-feedback added

comment:5 nkuttler4 years ago

  • Owner set to nkuttler
  • Status changed from new to accepted

comment:6 dd324 years ago

Would it be worth sanitizing the taxonomy name as well?

comment:7 nkuttler4 years ago

Indeed, and I've cleanup up the patch a bit.

comment:8 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.1
  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.