Opened 3 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
Priority: normal Milestone: 3.1
Component: Taxonomy Version:
Severity: normal Keywords: has-patch, ui-feedback
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 3 years ago.
Trivial patch
body_class_tax2.diff (665 bytes) - added by nkuttler 3 years ago.
body_class_tax2.2.diff (656 bytes) - added by nkuttler 3 years ago.
body_class_tax.trunk.diff (684 bytes) - added by nkuttler 3 years ago.

Download all attachments as: .zip

Change History (12)

Trivial patch

The first patch was flawed. The second one adds

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

which makes this usable.

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

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

  • Keywords has-patch, ui-feedback added; has-patch removed
  • Owner set to nkuttler
  • Status changed from new to accepted

comment:6   dd323 years ago

Would it be worth sanitizing the taxonomy name as well?

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

  • 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.