WordPress.org

Ready to get started?Download WordPress

Forums

Styling authors own comments (3 posts)

  1. solarwind
    Member
    Posted 7 years ago #

    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, http://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

  2. petit
    Member
    Posted 7 years ago #

    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!

  3. solarwind
    Member
    Posted 7 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags