Styling comments using "li.comment-author-admin" using custom Functions (4 posts)

  1. salomon.meij
    Posted 4 years ago #


    I'm having a bit of a problem. Since I wanted to customize comments more than standard CSS allows, I had to use the functions.php to call for differently set up comments. I required the comment text to be first, contained in a speech bubble, with the author name and date underneath the bubble. This required the comment-text php calls to be in a separate div from the comment author and date calls.

    See: comments image (I added div markers etc)

    However, I ran into a problem, I actually want to style the speech boxes differently if they're made by an admin. Normally, you would do this using the "li.comment-author-admin" styling, however, this'll apply to the whole comment "box", so to speak, and not just the div containing the speech text which is styled a speech bubble. As a result, the speech bubble isn't styled differently, but the space around it is.

    I was wondering how can I add a "li.comment-author-admin" command to my custom div that I use to create my speech bubble?

    You can take a look at the actual code here, if it helps:


  2. salomon.meij
    Posted 4 years ago #

    Nobody? I just can't get it to work and it's driving me nuts!

  3. Michael
    Part-Time Forum Moderator
    Posted 4 years ago #

    please use the http://pastebin.com/ (see http://codex.wordpress.org/Forum_Welcome#Posting_Code ) for your code; and post a link to your site.
    formatting issues can best be discussed seeing the problem live.

  4. salomon.meij
    Posted 4 years ago #

    Funtions.php: http://pastebin.com/8QENEQpv

    Comments.php: http://pastebin.com/nCMfs04p

    Style.css: http://pastebin.com/Fz50Y4hG

    Sadly I can't link to my website, cause it's currently running on localhost and I haven't set up an actual web host yet. The image shows how it renders, though. Sorry for the inconvenience.

    As for the code, I messed up something in the code as well that breaks parts of WordPress, some pages don't open anymore. However, I figured I'd fix that later, after I figure out how to fix my styling.

    If you look in the functions.php, what I would like to do is give the divs

    <div class="replyimg">


    <div class="comment-text">

    An ID like "ol.commentlist li.comment-author-admin" that WordPress gives to comments by default. I basically sliced my comment up into separate divs, instead of one big comment, but I would like fine control over those separate divs using the functions like "ol.commentlist li.comment-author-admin".

Topic Closed

This topic has been closed to new replies.

About this Topic