I don’t know if this is possible, I’ve searched around but came up short. Basically, I need that the current user who is commenting to see his comments slightly different than the rest.
I’m doing this for admins/moderators, but the thing is that all users see the highlighted comments made by admin/mod, where here I just want every user to see his comments as highlighted.
assumes that your theme is using
comment_class()
;example (to be added to functions.php of your theme):
requires formatting of the css class:
I recently posted a plugin version in my site.
First, if you look at the comment classes, you will notice a class called
byuser
. That class is one of the default classes added bycomment_class
. That is all you need. You can style that with CSS however you want.If you theme is not using
comment_class
as it should be then…Look in your theme’s
comments.php
for a function namedwp_list_comments
. In Twenty Twelve it looks like this:wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) );
.That
callback
part is the important part here. If there is a callback in your theme’s function call, that is what you need to alter. If there is no callback the WordPress default will be used so there should be no problem.comment_class
should already be in use.The theme should have a function named the same as that callback’s value in the code above. For Twenty Twelve it is
twentytwelve_comment
which is defined infunctions.php
. That formats and displays the actual comment list. All you should need to do is duplicate/edit that function and add thecomment_class
function, right around here.