WordPress.org

Plugin Directory

wiki:LiveCommentPreview

Live Comment Preview

Live Comment Preview is the simplest way to get live comment previews on your site. Simply activate the plugin. That's it'''

Installation

Installing Live Comment Preview is ridiculously simple:

  1. Download live-comment-preview.php
  2. Upload live-comment-preview.php into your wp-content/plugins directory.
  3. Activate the plugin through the WordPress admin interface.

Enjoy!

Usage / Caveats

The plugin will work automatically with either of the default themes and many 3rd party themes.

By default, the commentPreview div will show up here in both of the WP default themes where this code is in the comments.php file:

<?php do_action('comment_form', $post->ID); ?>

However, if you're using a 3rd party or customized theme, the commentPreview div may not appear. Should that be the case, you can insert the commentPreview div by adding this code is to your theme's comments.php file.

<?php live_preview(); ?>

Additionally, if you've seriously changed the markup to your comment form (messing with ID's), then you may need to edit the plugin itself to match the ID's that you changed. They are stored in easy to change variables at the top of the plugin:

$commentFrom_commentID = 'comment';
$commentFrom_authorID  = 'author';
$commentFrom_urlID     = 'url';

Finally, if you don't like the default way the preview is output, you can change the output formatting in the plugin as well:

// Customize this string if you want to modify the preview output
// %1 - author's name (as hyperlink if available)
// %2 - comment text
$previewFormat         = "<p><strong>Preview:</strong></p><p><em>%1:</em></p><p>%2</p>";

However, you most likely will not need to change any of this.

Thanks!

  • Big time thanks to Iacovos Constantinou for his wicked cool JS functions for parsing the comment text.
  • Also thanks to Justin Watt for pointing out some (rather obvious) short comings :D
Last modified 8 years ago Last modified on 04/06/06 22:04:22