• Resolved Doodlebug

    (@doodlebug)


    Hi,

    I’m using the method from this page:
    http://www.mattcutts.com/blog/highlight-author-comments-wordpress/

    …to highlight my own comments as admin/author of my blog.

    However, implementing that code has resulted in the styling I created for alternate posts (eg. every other comment has a different background colour) from working.

    Looking in the source of my page in the browser, it shows an alternate comment as having this class…

    <li class="class="alt" "id="comment-7">

    So obviously something has gone wrong but my PHP skillz can’t solve this simple problem.

    Any help is appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • That is way I used to setup my author highlighting.

    <li class="<?php echo $oddcomment; ?> <?php if ($comment->user_id == '1') echo 'author'; ?>" id="comment-<?php comment_ID() ?>">

    $oddcomment is my alternating variable class.

    You might want to post your comment template to http://wordpress.pastebin.ca and give a link.

    Thread Starter Doodlebug

    (@doodlebug)

    I’ve uploaded what my comments.php code looks like here:
    http://wordpress.pastebin.ca/1173219

    Thread Starter Doodlebug

    (@doodlebug)

    Line 17 seems to have the format for the bad class being spat out, but this is in the bit that shouldn’t and wasn’t edited.

    Here’s the updated template.
    http://wordpress.pastebin.ca/1173229
    Line 17 was the culprit.

    We cross-posted there a little. I think that guide assumed a little to much about your setup.

    Thread Starter Doodlebug

    (@doodlebug)

    Weirdly I copied in your method for line 29 (from your first reply) and then used your fix for line 17. The problem still persisted, but this time some of the highlighted admin comments weren’t highlighted anymore.

    Because as well as
    <li class="class="alt" " id="comment-6">
    it would give
    `li class=”class=”alt” authcomment” id=”comment-8″>’
    when a post was both admin highlight and alternate.

    So I changed line 29 back to how I had it at the start and the original problem remains.

    This is really quite strange.

    I normally test changes on my localhost, but i’ve added a few comments to the actual blog here: http://doodlebug.josephlavington.com/?p=17

    Thread Starter Doodlebug

    (@doodlebug)

    OK, so I believe i’ve now fixed this.

    Line 51 had a similar problem to line 17, so change it (51) to:
    $oddcomment = ( empty( $oddcomment ) ) ? 'alt ' : '';

    I’m no PHP expert, so if you think this isn’t the right way to do it, please let me know!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Admin comment highlight messes up alt comment styling’ is closed to new replies.