Wordpress dynamically add Admin or Author class to comment


/ Published in: PHP
Save to your folder(s)

Can now use the class as a styler


Copy this code and paste it in your HTML
  1. <li class="<?php
  2. $comment_author_ID = get_comment(get_comment_ID()) -> user_id;
  3. $auth_ID = get_the_author_meta('ID');
  4. echo ($comment_author_ID == $auth_ID) ? " author " : "" ;
  5. echo (is_super_admin($comment_author_ID)) ? " admin " : '' ;
  6. ?>">

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.