WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 9 months ago

Last modified 6 months ago

#38810 closed feature request (fixed)

Add level class to terms list-table rows

Reported by: johnjamesjacoby Owned by: boonebgorges
Milestone: 5.2 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: administration Cc:
PR Number:

Description

I have a need to style & target taxonomy terms of a certain depth in the terms list table. Posts already includes a level-%d style class, so this should be pretty straight forward.

One caveat is that posts uses get_post_ancestors() (and terms will need to use get_ancestors()) but this comment from @nacin may not apply in exactly the same way.

There also is no get_term_class() function ala get_post_class(), so I'm going to propose a patch for only the single purpose of this ticket vs. aiming for feature parity with posts.

See #25791, r26244. Patch imminent.

Attachments (1)

38810.patch (670 bytes) - added by johnjamesjacoby 3 years ago.

Download all attachments as: .zip

Change History (7)

#1 @johnjamesjacoby
3 years ago

  • Keywords 2nd-opinion has-patch added

#2 @johnjamesjacoby
3 years ago

  • Summary changed from Add level class to terms list-table (to match posts) to Add level class to terms list-table rows

#3 @johnjamesjacoby
3 years ago

For added context, I have this plugin: https://wordpress.org/plugins/wp-term-order/

As is, I cannot target terms within the same branch in the hierarchy, which results in the next/prev/current positions only being based on a flat term relationship. This means when terms are reordered, it reorders the entire view, not just siblings.

The attached patch would allow me to target .level-2, and I could query, rearrange, and redraw only the correct terms.

#6 @boonebgorges
9 months ago

  • Keywords bulk-reopened added
  • Milestone set to 5.2

This seems like a good and straightforward enhancement.

Performance issues were my only initiall concern. But seeing as this arises only on edit-tags.php, performance is less worrisome. Moreover, the way that edit-tags.php is built (top-of-hierarchy, down), the parents fetched by get_term( $term->parent ) should be in the cache in nearly all circumstances.

#7 @boonebgorges
9 months ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 44804:

Taxonomy: Add level-n classes to rows on edit-tags.php.

Props johnjamesjacoby.
Fixes #38810.

#8 @desrosj
9 months ago

  • Keywords 2nd-opinion bulk-reopened removed
Note: See TracTickets for help on using tickets.