#9301 closed defect (bug) (fixed)
no classes on div-coment in Walker_Comment::start_el()
| Reported by: | docwhat | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Template | Version: | 2.7 |
| Severity: | normal | Keywords: | has-patch tested |
| Cc: | Focuses: |
Description
There are no classes on Walker_Comment::start_el() when it creates a <div id="div-comment-NNNN"> node.
This makes using CSS target that node pretty hard if not impossible across browsers.
Ideally, it would have a class like "comment-body".
This is a feature aid semantic markup.
Change History (7)
#4
@
18 years ago
It would have before we added the "Reply" and nested comments. But now the markup can change, on the fly, from (this is from memory, so the classes might be wrong):
<li class="comment"> <div id="div-comment-NN" /> </li>
to
<li class="comment"> <div id="div-comment-NN" /> <div id="response" /> </li>
So you can't use a rule like:
.comment > div { ... style the body of the comment ... }
... without getting the reply box, too.
Before this change, I'd just use css like this:
.comment { border: 1px solid blue; }
But the box will bound the replies too; which isn't what I wanted.
Ciao!
#5
@
17 years ago
- Component General → Template
- Keywords tested added
- Milestone Unassigned → 2.8
- Version → 2.7
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Example Patch
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index a4a126b..49cdfc1 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1221,3 +1221,3 @@ class Walker_Comment extends Walker { <?php if ( 'ul' == $args['style'] ) : ?> - <div id="div-comment-<?php comment_ID() ?>"> + <div id="div-comment-<?php comment_ID() ?>" class="comment-body"> <?php endif; ?>