Support » Themes and Templates » Styling comments using "li.comment-author-admin" using custom Functions

  • Hello,

    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:


Viewing 3 replies - 1 through 3 (of 3 total)
  • Nobody? I just can’t get it to work and it’s driving me nuts!



    Forum Moderator

    please use the (see ) for your code; and post a link to your site.
    formatting issues can best be discussed seeing the problem live.




    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”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Styling comments using "li.comment-author-admin" using custom Functions’ is closed to new replies.