WordPress “comment_class” filter

Filters :

comment_class :

Calls when comments are displayed in a post, it is called for generating the css classes for the comment block.

You can add your css class with them to highlight a comment or do any customization you want.

How to use :

Register the filter :

add_filter('comment_class', "test_function", 1 );

Define The Function :

function test_function($classes)
{
     classes[] = "my-css-class";
     return $classes;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s