Opened 5 years ago
Closed 5 years ago
#8091 closed enhancement (fixed)
"Parent" Comment Class
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.7 |
| Component: | Comments | Version: | 2.7 |
| Severity: | normal | Keywords: | has-patch Walker_Comment |
| Cc: |
Description
A comment <li> with "children" should get a class of "parent".
Attachments (2)
Change History (15)
comment:1
Viper007Bond — 5 years ago
comment:2
Viper007Bond — 5 years ago
Hmm.
+1 to idea
-1 after looking at the code. It doesn't seem easily doable unless I'm missing something.
comment:3
Viper007Bond — 5 years ago
- Keywords needs-patch added
- Milestone changed from 2.7 to 2.8
- Version set to 2.7
Pushing back to 2.8.
- Keywords has-patch Walker_Comment added; needs-patch removed
- Milestone changed from 2.8 to 2.7
A two-line patch isn't too bad for 2.7, right?
comment:5
Viper007Bond — 5 years ago
Wow, I feel stupid. I totally forgot comment_class() accepted parameters. I was looking at comment_class() itself trying to figure out how it could know if there were children or not (ugly globals, SQL queries, etc.).
$args[0]['has_children'] = ( empty( $children_elements[$element->$id_field] ) ) ? false : true;
Eugh.. Can i just say i'm sick of if statements(let alone condensed if statements) with boolean return values.. I can understand for something complex, But seriously:
$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
reads much cleaner to me.
Sorry for the mini rant.. Its just a small anoyance of mine :) (aside from extra brackets around boolean questions)
comment:8
markjaquith — 5 years ago
- Resolution set to fixed
- Status changed from new to closed
- Keywords needss-patch added; has-patch removed
- Resolution fixed deleted
- Status changed from closed to reopened
I'm reverting this for now as it introduces errors - #8303
comment:10
westi — 5 years ago
That is reverting the change to classes.php
comment:11
westi — 5 years ago
Make that re-opening.... (need coffee)
comment:12
filosofo — 5 years ago
- Keywords has-patch added; needss-patch removed
Patch consistent_start_el_args.diff fixes this on two levels:
- It checks to make sure that $args[0] is actually an array. The empty check was pointless, since it should never be empty.
- If fixes a more fundamental problem: walk_page_tree() calls the "walk" method with arguments in an inconsistent order. One of these is not like the others in argument order, and it's the "start_el" method for Walker_Page (defined on line 1155 of wp-includes/classes.php):
wp-admin/includes/template.php:412: function start_el(&$output, $category, $depth, $args) {
wp-includes/comment-template.php:1151: function start_el(&$output, $comment, $depth, $args) {
wp-includes/classes.php:782: function start_el(&$output) {}
wp-includes/classes.php:1155: function start_el(&$output, $page, $depth, $current_page, $args) {
wp-includes/classes.php:1233: function start_el(&$output, $page, $depth, $args) {
wp-includes/classes.php:1310: function start_el(&$output, $category, $depth, $args) {
wp-includes/classes.php:1425: function start_el(&$output, $category, $depth, $args) {

+1
Extra CSS classes can never hurt and it makes it easier to select parents for styling purposes.