Opened 18 years ago
Closed 18 years ago
#8091 closed enhancement (fixed)
"Parent" Comment Class
| Reported by: | ThemeShaper | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.7 |
| Component: | Comments | Version: | 2.7 |
| Severity: | normal | Keywords: | has-patch Walker_Comment |
| Cc: | Focuses: |
Description
A comment <li> with "children" should get a class of "parent".
Attachments (2)
Change History (15)
#2
@
18 years ago
Hmm.
+1 to idea
-1 after looking at the code. It doesn't seem easily doable unless I'm missing something.
#4
@
18 years ago
- Keywords has-patch Walker_Comment added; needs-patch removed
- Milestone 2.8 → 2.7
A two-line patch isn't too bad for 2.7, right?
#5
@
18 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.).
#6
follow-up:
↓ 7
@
18 years ago
$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)
#9
@
18 years ago
- Keywords needss-patch added; has-patch removed
- Resolution fixed
- Status closed → reopened
I'm reverting this for now as it introduces errors - #8303
#12
@
18 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 forWalker_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) {
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
+1
Extra CSS classes can never hurt and it makes it easier to select parents for styling purposes.