jump to navigation

Try Firefox - it's faster, and more secure than internet explorer. It even has a cute little mascot.

Journal

BM-Comment-Highlight Guide

January 28, 2008 | Web Design

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:

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.

Comments »

  1. 1. Jenny
    February 1, 2008

    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.

  2. 2. codeodd
    February 3, 2008

    … is there a way to get it and avoid downloads?

  3. 3. Jay Marks
    February 14, 2008

    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

  4. 4. Ben
    February 14, 2008

    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.

  5. 5. jullian
    February 21, 2008

    looool again Ben link is not working

  6. 6. jullian
    February 21, 2008

    this comment is because i forgot to check the notify me box

  7. 7. Alberto
    February 21, 2008

    The link to download the plugin doesn’t work…

  8. 8. jullian
    February 21, 2008

    http://wordpress.org/extend/pl...

    i got the link from word press

  9. 9. Ben
    February 21, 2008

    Aaarghh - they changed it back to how it was originally!

    I’ll change them all again :S

  10. 10. Kevin
    February 22, 2008

    im lost as to where to put this code and i think im pretty code snazzy

  11. 11. georges
    February 23, 2008

    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)

  12. 12. Rob
    March 1, 2008

    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.

  13. 13. Matt Balara
    March 2, 2008

    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?

  14. 14. Ben
    March 2, 2008

    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.

  15. 15. Matt Balara
    March 2, 2008

    Yup, that did the trick. Excellent! Thanks Ben!

  16. 16. Sheamus
    April 4, 2008

    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.

  17. 17. Ben
    April 4, 2008

    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 :) )

  18. 18. kevin
    April 4, 2008

    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.

  19. 19. Bill
    April 6, 2008

    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}

  20. 20. Ben
    April 7, 2008

    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.

Leave a message tell me what you're thinking

Please feel free to comment - I like receiving them - however I would appreciate you using your real name. I am not here to improve your search engine ranking. Abusive/ Inappropriate posts and advertisements will be deleted.

Binary Moon