Thread Starter
wajih
(@wajih)
I resolved it!
I just replaced the_author() and comment_author() by get_the_author() and get_comment_author() respectively, and it works flawlessly 🙂
CASE CLOSED 😀
I believe that you want get_the_author() instead of the_author(). If you look at author_template.php you will see that the later echos the result of the former.
Can anyone suggest a way to do the same thing you’re doing here, but for multiple authors?
Basically what I want is for anyone who is a contributor or above, their comments are a certain class, where just subscribers have a separate style. Any help is appreciated.
(@wajih)
18 years, 4 months ago
Hello!
Well I’m trying to modify my comments.php file in order to change the background color (change the CSS of comments) so that if a regular user post a comment, a particular style will be applied, and if the author of the post itself replies (hence post), another style will be applied.
Here is what I did, which does not work (keep in mind that I am completely new, even to PHP):
So what it is doing, instead of of comparing the two, it is outputting (echo’ing) on the webpage. In this case, the_author is admin, and comment_author is also admin, and it is outputting adminadmin (1 word), and outputs the code which is in my else() statement.
So am I doing wrong?
Thanks for your help 🙂