Want to know when there are new posts?

SUBSCRIBE VIA EMAIL

SUBSCRIBE VIA RSS

Aug 6th

Adding Live Preview For Comments

Topics: All Things Wordpress Code

If you scroll down you will see a live preview option for comments. Just try it out by typing in a comment. Pretty cool, huh!?

A friend asked me why this was useful and why anyone will want to see their comment twice?

My answer: If your comment is pretty long, the textarea will start to scroll and you won’t be able to look at your entire comment in on go. The preview on the other hand shows the comment in its entirety. This way you can see how it looks and proof read with ease before you post.

I have gotten this technique from the Rockatee Blog. So a big thank you to Maleika.

  1. First things first. You need to download jQuery. Lets just name it jquery.js and place it in your theme folder.
  2. Next download this file and place it in your theme folder.
  3. Now open header.php from your theme and add these lines in the head area:

    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/jquery.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/preview.js"></script>

  4. Last step is to add the following code to you comments.php file wherever you want the live preview to show up.

    <div class="comment-preview"> <h3>My Comment Preview</h3> <p class="live-preview">Add some instructions - this text will get replaced by the comment preview.</p> </div>

  5. You can use the class p.live-preview to style the live comment preview.

See that was simple and you have your own comment live preview.

Tags: , ,



RSS Feeds

3DEcovers.com

Amazing Breakthrough In 3-D ECover Actions

If You're An Information Marketer Who Yearns To Transform Your Ecover Graphics From Ho-Hum To HOLY SMOKES, Then You've Got To Read This Story...

Related Posts

4 Responses to “Adding Live Preview For Comments”


  1. That is pretty cool - I see how it works here too. i do have to say I like seeing it when leaving comments, i just might have to add it to my sites some time.

    Blog Post: Keep Out of The Pond!

  2. Yah, it is kinda fun when you see the comment preview as you type :)

    Btw I really enjoyed visiting your site.

  3. Hi Erum,

    I very much like your implementation of the live comments feature, having it at the bottom rather than on the side.

    Oh, and a very nicely designed blog you have here. :)
    Blog Post: RSS and Atom Feeds now Working

  4. Thanks Maleika! Glad you like the design :)

    And thank you again for the live comments code.


What Do You Think?

Enter your name as YourName@YourKeywords and YourKeywords will be used as the anchor link to your website. Psst this gives you Page Rank advantage.

  1. (required)
  2. (required)
  3. (required)

Comment Preview:

Just in case you wanna see.

You can also subscribe to comments via RSS Comments RSS