#25791 closed enhancement (fixed)
Add a nesting level class to <tr> elements in #the-list
Reported by: | jhned | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | minor | Version: | 3.8 |
Component: | Administration | Keywords: | needs-testing has-patch |
Focuses: | Cc: |
Description
In the admin, there's a big table (#the-list) for the list of pages. The WordPress admin file class-wp-posts-list-table.php currently adds a bunch of classes to the individual table rows for each page. What it does not add is a class for the page's nesting level.
I'd like to add one because scrolling through 100+ pages is tedious, and being able to style the different levels can be very helpful for seeing where you are at a glance.
I'm attaching a piece of code for line 494 of /wp-admin/includes/class-wp-posts-list-table.php that will add this functionality. I have tested it on the latest version of WordPress, but I'd imagine that it will require further testing if it is to be included in the core.
Attachments (2)
Change History (8)
#1
@
11 years ago
Could you please attach an SVN patch rather than a PHP file? See http://make.wordpress.org/core/handbook/submitting-a-patch/.
#3
@
11 years ago
- Milestone changed from Awaiting Review to 3.8
jhned and I worked through this at the WC Orlando contributor day. The patch looked good; the concern at that point led to whether the call to get_post_ancestors() was a performance hit, in terms of increased queries.
Normally, we have the full hierarchy already, so there is no penalty. But if a search only returns a non-top-level page, we won't yet have its ancestors. At this point, we would need to run new queries.
However, we separately need the ancestors for two other reasons. One, if pretty permalinks are turned on, we need them in get_page_uri() for the 'View' action link. Two, we need to figure out how many levels deep that page is so we can properly display its level, via em-dashes. (We also need its parent so we can show "Parent Page:", but ancestors are still needed for levels.) That particular code is in the list table — $level = 0 but we know better, so we need to calculate the depth.
add_nesting_class.diff is good to go.
#4
follow-up:
↓ 5
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 26244:
Nesting Class Patch for class-wp-posts-list-table.php