I have been trying to add the following code to display the ratings inline with the corresponding comment in the Thesis Theme comments.php file:
<?php if (function_exists('comment_ratings_table')) comment_ratings_table(); ?>
Chris has heavily modified the comments.php code, which is here:
<?php
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die (__('Please do not load this page directly. Thanks!', 'thesis'));
if (!empty($post->post_password)) { // If this post is password-protected
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
echo '<p>' . _e('This post is password protected. Enter the password to view comments.', 'thesis') . '</p>' . "\n";
return;
}
}
if ($comments || comments_open()) { // If comments exist or comments are open...
?>
<div id="comments">
<?php
if ($comments) { // If there are comments, display them!
foreach ($comments as $comment) {
if ($comment->comment_type == 'trackback' || $comment->comment_type == 'pingback')
$trackbacks[] = $comment;
else
$only_comments[] = $comment;
}
if ($trackbacks) {
thesis_comments_intro(count($trackbacks), pings_open(), 'trackbacks');
?>
<dl id="trackback_list">
<?php
foreach ($trackbacks as $comment) {
?>
<dt><?php comment_author_link(); ?></dt>
<dd><?php comment_date('m.d.y'); _e(' at ', 'thesis'); comment_time(); ?></dd>
<?php
}
?>
</dl>
<?php
}
if ($only_comments) {
thesis_comments_intro(count($only_comments), comments_open());
?>
<dl id="comment_list">
<?php
$comment_number = 1;
$alt_comment = '';
foreach ($only_comments as $comment) {
?>
<dt class="comment<?php if ($alt_comment == 'alt') echo (' alt'); if (get_comment_author_email() == get_the_author_email()) echo (' author_comment'); if ($comment->comment_approved == '0') echo ' moderated'; ?>" id="comment-<?php comment_ID() ?>">
<?php
thesis_hook_before_comment_meta();
thesis_comment_meta($comment_number);
thesis_hook_after_comment_meta();
?>
</dt>
<dd class="comment<?php if ($alt_comment == 'alt') echo (' alt'); if (get_comment_author_email() == get_the_author_email()) echo (' author_comment'); if ($comment->comment_approved == '0') echo ' moderated'; ?>">
<div class="format_text">
<?php
if ($comment->comment_approved == '0') {
?>
<p><strong><?php _e('Your comment is awaiting moderation.', 'thesis'); ?></strong></p>
<?php
}
comment_text();
thesis_hook_after_comment();
?>
</div>
</dd>
<?php
if ($alt_comment == 'alt')
$alt_comment = '';
else
$alt_comment = 'alt';
$comment_number++;
} // end foreach comment
?>
</dl>
<?php
}
elseif (comments_open())
thesis_comments_intro(0, comments_open());
if (!comments_open()) {
?>
<div class="comments_closed">
<p><?php _e('Comments on this entry are closed.', 'thesis'); ?></p>
</div>
<?php
}
}
elseif (comments_open())
thesis_comments_intro(0, comments_open());
if (comments_open()) {
if (get_option('comment_registration') && !$user_ID) { // If registration is required and the user is NOT logged in...
?>
<div class="login_alert">
<p><?php _e('You must <a href="' . get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode(get_permalink()) . '" rel="nofollow">log in</a> to post a comment.', 'thesis'); ?></p>
</div>
<?php
}
else { // Otherwise, show the user the stinkin' comment form already!
?>
<div id="respond">
<p><?php _e('Leave a Comment', 'thesis'); ?></p>
</div>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php
if ($user_ID) // If the user is logged in...
echo '<p>' . __('Logged in as <a href="' . get_option('siteurl') . '/wp-admin/profile.php" rel="nofollow">' . $user_identity . '</a>.', 'thesis') . ' ' . __('<a href="' . thesis_logout_url() . '" title="Log out of this account" rel="nofollow">Logout →</a>', 'thesis') . '</p>' . "\n";
else { // Otherwise, give your name to the doorman
?>
<p><input class="text_input" type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1"<?php if ($req) echo ' aria-required="true"'; ?> /><label for="author"><?php _e('Name', 'thesis'); if ($req) _e(' <span class="required" title="Required">*</span>', 'thesis'); ?></label></p>
<p><input class="text_input" type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2"<?php if ($req) echo ' aria-required="true"'; ?> /><label for="email"><?php _e('E-mail', 'thesis'); if ($req) _e(' <span class="required" title="Required">*</span>', 'thesis'); ?></label></p>
<p><input class="text_input" type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" /><label for="url"><?php _e('Website', 'thesis'); ?></label></p>
<?php
}
?>
<p class="comment_box"><textarea name="comment" id="comment" tabindex="4" cols="40" rows="8"></textarea></p>
<p class="allowed">
<span>
<?php
_e('<em>You can use these <acronym title="HyperText Markup Language">HTML</acronym> tags and attributes:</em> ', 'thesis');
echo allowed_tags() . "\n";
?>
</span>
</p>
<?php thesis_hook_comment_form(); ?>
<p>
<input name="submit" class="form_submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'thesis'); ?>" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php
}
}
?>
</div>
<?php
}
any ideas where/how I can insert the wpreviewsite code to properly display the ratings inline with each comment?
Thank you in advance!
go to comment.php add the code in red between the code in black, this is the way i did it on my thesis theme.. and it works![]()
! else { // Otherwise, show the user the stinkin' comment form already!
?>
<div >
<div >
<p><?php comment_form_title(__('Leave a Comment',
'thesis'), __('Reply to %s:', 'thesis')); ?></p>
</div>
<form action="<?php echo get_option('siteurl'); ?>/wpcomments-
post.php" method="post" >
<!-- start of rating in the comment form -->! ! ! ! !
<?php if ( in_category( array( '244', '153' ) ) ): ?>
<div >
<div >Rate Here:</div>
<?php if (function_exists('ratings_input_table')) ratings_input_table(); ?>
</div>
<?php endif; ?>
<!-- end of rating in the comment form -->
<?php
if (get_option('thread_comments')) {
?>
<div >
<p><?php
cancel_comment_reply_link(__('Cancel reply.', 'thesis')); ?></p>
</div>
<?php
}
?>
Thanks for this, but I'm trying to get this code to display:
<?php if (function_exists('comment_ratings_table')) comment_ratings_table(); ?>
I have the INPUT table...that's not my problem. Getting each users rating table to show with their comment, this is where I am stuck. Thanks!
Where you see "comment_text();", that is the code that displays the text of a comment, so near there is probably where you want to add the code. Or you can just check off the box in the plugin settings to tell it to add the ratings to your comments automatically without editing code.
Sending ...