feed me feed me chillireward

Article (in detail)

Comments Tweak in Wordpress -1

 

Making your comments section look nice

You need to know some CSS and have a fair idea of how a PHP code works.

Have you come across those sites where comments are displayed beautifully with a separate look for author comments and an alternating look for the rest of the folk?

Chilligavva too carries this style. Take a look. I shall quickly tell you how to do the same with your wordpress blog. There are two steps, step-1 the code manipulation and step-2 defining the styles for the same.

Part-1: Manipulating the code

Look for the following code in comments.php located in the folder
“wordpress-folder / wp-content / themes / current theme / “

<?
if ($comments) :
foreach ($comments as $comment) :
$isByAuthor = false;
if($comment->comment_author_email == ‘email@domain.com’) {$isByAuthor = true; }
?>
 

And replace it with the following code

<? if ($comments) :
foreach ($comments as $comment) :
$isByAuthor = false;
if($comment->comment_author_email == ‘email@domain.com’) { $isByAuthor = true;}
if (‘alt’ == $oddcomment &amp;&amp; $isByAuthor == true) $oddcomment = ‘auth’;
elseif (‘alt’ == $oddcomment &amp;&amp; $isByAuthor == false) $oddcomment = ‘def’;
else $oddcomment = ‘alt’;
?>

Make sure that you substitute the generic “email@domain.com” in the above code with the actual email of the author, as defined in the wordpress settings.

Part 2: Defining styles in style.css

Popularity: 22% [?]

Page copy
protected against web site content infringement by Copyscape

Liked this article? Subscribe to the article feed via feedburner. Dont want to be hassled by feeds, you can Subscribe by E-mail. Want to know who said what? Get my comments feed. Dont know what a RSS feed is? Read about RSS feeds.

Other Posts for you to Enjoy

Feedback Please!

Note: Your comments may take time to appear, as they are moderated for the first time..

All comments are followed.

 
 
Security Image