Hello all,
I'll keep this as short as possible. I've been using live comment preview on my site for a few months now but when I created a new theme, using HTML5 elements, the comment preview stopped working. I don't think it's anything I've done as I haven't changed the code I was using when it was working previously.
One thing I cannont get my head around is the fact that the comment preview works perfectly when I'm logged in and posting a comment through the form as usual. But as soon as I log out the preview stops working. I've tried fiddling about with a few parts of the plugin and my own comments.php file but I'm not that great at php and don't really know if what I'm doing is correct, it's all a bit hit and miss.
Hopefully someone out there will have had the same problem as me or will know how to fix it.
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(); ?>" title="Log out of this account">Log out »</a></p>
<?php else : ?>
<aside>
<h3>Allowed XHTML</h3>
<p><?php echo allowed_tags(); ?></p>
<p>Line breaks and paragraphs are automatically generated.</p>
<h3>Guidelines</h3>
<p>Off-topic or inappropriate comments will be edited or deleted.</p>
</aside>
<section>
<aside>
<h3>Your Details</h3>
<label for="author">Name <?php if ($req) echo "(required)"; ?></label>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email">E-Mail (not published) <?php if ($req) echo "(required)"; ?></label>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="url">Website</label>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<?php endif; ?>
</aside>
<h3>Post Your Views On The Subject</h3>
<textarea name="comment" id="comment" cols="45" rows="10" tabindex="4"></textarea>
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</section>
</form>
<section id="form-extras">
<aside>
<h3>Follow Comments</h3>
<?php show_subscription_checkbox(); ?>
</aside>
<section>
<h3>Comment Preview</h3>
<?php do_action('comment_form', $post->ID); ?>
</section>
</section>
I've firebugged the live comment preview section and it's just showing the commentPreview div as empty.