In my excitement to get the BM-Comment-Highlight plugin out yesterday I forgot to tell you how to actually use the thing. Also since posting it yesterday I have though of another feature for the plugin so I have updated it accordingly.
How to use BM-Comment-Highlight
To use the plugin all you have to do is include a single php function call in your wordpress loop. This will return to you a string that you can use as a class in any way you see fit.
<?php foreach ( $comments as $comment ) {
$commentClass = bm_commentHighlight(); ?>
<li class="<?php echo $commentClass; ?>">
<?php comment_text(); ?>
</li>
<?php } ?>When the function is called you will get a number of classes returned (most likely more than one). These let you style the comment appropriately.
The classes you get are:
- author - the commenter is the post author
- reader - the commenter is simply a reader of the blog
- user - the commenter is a registered user
- userID_# - the # is the user id of the registered user that has commented
- pingback - the comment is a pingback
- trackback - the comment is a trackback
Updates?
The update to the plugin is the additional feature of telling you if the comment is a comment, a trackback, or a pingback. This will let you style your incoming links in a more effective way.
24 Responses to “BM-Comment-Highlight Guide” Leave a reply ›
I downloaded it like a minute ago and am testing it in my new theme. I'll be back to let you know how it went. Although I should say you should give like a little preview of it at least on your plugin page. But it's just a thought.
... is there a way to get it and avoid downloads?
Hi Ben-
Loyal follower here -for Regulus
Any chance of getting a more bold text on the left side categories?
Any chance to have a larger font here-
thanks so much-
Jay
Jenny - there's a screenshot up the top there. Is that not good enough?
CodeOdd - it doesn't work on wordpress.com blogs I'm afraid
Jay - that seem unrelated to the plugin?
Regardless, these things are easy to change in the themes css files if you have access to edit them.
looool again Ben link is not working
this comment is because i forgot to check the notify me box
The link to download the plugin doesn't work...
http://wordpress.org/.../bm-comment-highlight/#post-2828
i got the link from word press
Aaarghh - they changed it back to how it was originally!
I'll change them all again :S
im lost as to where to put this code and i think im pretty code snazzy
I'm an idiot. Will you please explain to me where you would place this? Please talk like you are speaking to a 5 year old, and then maybe I will get it.
:O)
Hey. Great plugin, exactly what I have been looking for. I put the code into the comment.php file. So far so good - but how exactly do I define the classes?
Cheers.
I love the idea, and have been looking for something similar for a while, but after putting the code in my template, my comments no longer load and I get an error: "Warning: Invalid argument supplied for foreach()".
Any ideas?
Georges - you stick the code in the comments template along with the comment loop.
Matt - I got the sample code wrong. Take another look and let me know how you get on.
Rob - the classes would be saved in the styles.css file. If you don't know css this will be harder.
Yup, that did the trick. Excellent! Thanks Ben!
Like Kevin, I consider myself pretty up-to-speed on WordPress and plugins and can't get my head around the installation of this at all.
I'm afraid it's more than a case of uploading the plugin and activating it. I couldn't think of a nice clean way to include the comment styles so this is the best I have. If you could try to explain what you don't understand then I will see if I can be clearer. Obviously since I made the thing I understand what's going on so it all seems easy to me (it is, honest
)
It kept giving me PHP errors, but I spent some time trying to fix it and got it myself.
Never replied back but just got an email.
this is all you need to add to file:
wp-content/themes/yourtheme/comment.php
After:
Add:
Replace: "
add to wp-content/themes/yourtheme/style.css
.user { css styes here}
.reader { css styes here}
.author { css styes here}
Kevin - php errors? I'm not aware of any. Glad you got there in the end
Bill - your code isn't displaying
If you email it to me through the contact form on my about page then I will add it to your comment.
Hey, I would really like to use this plugin but have no idea where and how to implement this code and what sort of things I could do with it, anyone what to give me some pointers?
Hi Ben,
sorry to bother you but it can't get that plugin to work. I dl and activated it, put the classes in my .css file and the code in my comments.php.
When i refreshe the page it stopps to load. I have erased the code in coments but let it in my .css file for further use.
Problem is - i wrote part of my comments myself and now i'm stuck. Pls have a look:
">
schrieb @ um
Hi,
I'am trying using the plugins, but I'am really novice...
Here is my comment.php file :
[code]
pour “”
id="comment-">
Says:
comment_approved == '0') : ?>
Votre commentaire est en attente de validation.
" title=""> at
[/code]
I failed trying to modify my comment file... Can somebody modify it for me ? I always get parse of syntax error
What ist the wppressloop? Where must I put the code?