• Hi there,
    Am trying to add a class to the comments generated section of the code so that I can style the title of my own posts.
    Using the Blix theme asa base currently by default it displays..
    <li id=”comment-1″ class=”comment”>
    <p class=”header”>1.

    and for next post.

    <li id=”comment-2″ class=”comment”>
    <p class=”header alt”>2.

    next post reverts back to class=”header”

    I wanted to add another class for my posts ie. class=”header me”
    and the relevant php for comments.php

    I have managed to style the text part of the post from a tutorial I found here, https://www.tamba2.org.uk/wordpress/commentstyling/
    and even wrapped the date and time into authors comment,
    but can’t get rid of header box, would rather add class to it anyway.
    A bit long winded-apologies, hope I have been clear, any help would be appreciated. Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you want to get rid of the special header box for all comments, you can just comment out <!– –> the part in comments.php, that outputs the header.

    If you want to keep it, but apply a different style, you can do it the same way you styled the text part of the authors comment. You already have the class=”comment” and class=”commentalt” ( or something like that ).
    You can use the same test you do for the text, and make a new ( meta data ) header and set the style = “header_me” for those comment headers that match.

    Apologies for the long winding and imprecise answer ??
    Hope it helps!

    Thread Starter solarwind

    (@solarwind)

    Thanks for your answer, I kind of know what I need to do,
    but getting the correct configuration is eluding me.

    <li id=”comment-<?php echo $commentcount ?>” class=”<?php comment_type(‘comment’,’trackback’,’pingback’); ?>”>
    <p class=”header<?php echo $commentalt; ?>”><?php echo $commentcount ?>.

    I’m thinking I need to add $commentme, after commentalt in the above.
    And:
    add commentme in the following code

    <?php
    $isByAuthor = false;
    if($comment->comment_author_email == ‘you@your_email_address’) {
    $isByAuthor = true;
    }
    ?>

    changing the

    if($comment->comment_author_email ==

    to if($header->headerme ==

    But ERRORS all over how I try

    I am a right proper php novice and shouldn’t be dabbling with things I don’t understand,
    but here I am, up to my neck.
    If you need more code, or you have the time any further guidance would be appreciated.

    Thanks again, just had a quick look at your blog v nice, will bookmark for a longer look later. Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Styling authors own comments’ is closed to new replies.