Here is a post with 12 comments :
http://test1.zomghentai.com/kateikyoushi-no-onee-san-2-h-no-hensachi-agechaimasu-episode-1
In my wordpress Discussion Settings, I have set it to
"Break Comments into Pages with 5 comments each"
As you can see, at the bottom of comments I have links to Page 1, 2, and 3.
The problem?
1) Page 1 (default page) is showing all 12 comments at once, instead of showing just 5
2) Page 2, and 3, are all the same as Page 1
-----
My comments.php file is as followed :
<div id="comments">
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<h3>This post is password protected. Enter the password to view comments.</h3>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'alt';
?>
<?php if ($comments) : ?>
<span style="font-size: 13px;"><strong>Comments</strong></span>
<ul>
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<div class="cauthor"><strong><?php comment_author_link() ?></strong> says on <?php comment_date('M jS, Y') ?> at <?php comment_time() ?><?php if ($comment->comment_approved == '0') : ?> (Your comment is awaiting moderation)<?php endif; ?></div>
<div class="cbox">
<?php comment_text() ?>
</div>
<div style="clear: both;"></div>
</li>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?>
<?php endforeach; /* end for each comment */ ?>
</ul>
<?php paginate_comments_links() ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post-> comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p>Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post-> comment_status) : ?>
<div class="postinput">
<span style="font-size: 13px;padding: 10px 0 0 0;"><strong>Leave a Comment</strong></span>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="http://www.hentaidreaming.com/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<form action="http://www.hentaidreaming.com/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <a href="http://www.hentaidreaming.com/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="http://www.hentaidreaming.com/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Logout »</a></p>
<?php else : ?>
<p>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="20" tabindex="1" />
<label for="author"><small>Name <?php if ($req) _e('<strong>(required)</strong>'); ?></small></label>
</p>
<p>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="20" tabindex="2" />
<label for="email"><small>Mail <?php if ($req) _e('<strong>(required, will not be published)</strong>'); ?></small></label>
</p>
<?php endif; ?>
<p>
<textarea name="comment" id="comment" tabindex="4" rows="10" cols="50" ></textarea>
</p>
<p>
<input name="submit" type="image" id="submit" class="input-submit" tabindex="5" value="Submit Comment" title="Please review your comment before submitting" alt="Submit Comment" src="http://www.hentaidreaming.com/wp-content/themes/hdreamwp/images/submit.gif" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div> <!-- End "postinput" -->
</div> <!-- End "comments" -->
Edit ** Sapan will you be able to do this for me if I offer $10?
In Ps answers:
The custom theme you have made for your website does not support Comments Threading. There would be 2 areas where changes are required... one on "<strong>comments.php</strong>"... You can copy the entire PHP code from the latest "twentyten" theme comments.php file and replace it in your current comments.php file.
If this gives you error on your blog post page (refresh) where comments appear, you will also need to replace php code on "<strong>functions.php</strong>" in your theme folder. Open that file for editing and there'd be a function for Comments. Replace the entire function by following code from "twentyten" functions.php...
if ( ! function_exists( 'twentyten_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own twentyten_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Twenty Ten 1.0
*/
function twentyten_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<?php echo get_avatar( $comment, 40 ); ?>
<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
</div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == '0' ) : ?>
<em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
<br />
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<?php
/* translators: 1: date, 2: time */
printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
?>
</div><!-- .comment-meta .commentmetadata -->
<div class="comment-body"><?php comment_text(); ?></div>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</div><!-- #comment-## -->
<?php
break;
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'twentyten'), ' ' ); ?></p>
<?php
break;
endswitch;
}
endif;
NOTE: This usually works but it'll screw a bit of your styles and you'd have to work a bit to put it back to normal. The latest TwentyTen theme code is actually the answer to all your worries :-)
I look forward to your feedback.
Sapan Shah
In Ps comments:
Yes I'll do it for $10, but only 1 issue... I'll try to keep your CSS styling intact BUT if some styles are changed, you take care of making further changes to CSS file. I'll make your comments threading (paging) work. Is that fine with you? Send me details and wow shall we proceed in case of price change?
Thanks, Sapan.
Jamie Kang comments:
I sent you a Private Message
In Ps comments:
Ok I have your solution below which has few steps which you need to follow carefully...
1. HERE IS YOUR NEW COMMENTS.PHP CODE (full)...
<div id="comments">
<?php if ( post_password_required() ) : ?>
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?></p>
</div><!-- #comments -->
<?php
/* Stop the rest of comments.php from being processed,
* but don't kill the script entirely -- we still have
* to fully load the template.
*/
return;
endif;
?>
<?php
// You can start editing here -- including this comment!
?>
<?php if ( have_comments() ) : ?>
<h3 id="comments-title"><?php
printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' );
?></h3>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<?php endif; // check for comment navigation ?>
<ol class="commentlist">
<?php
/* Loop through and list the comments. Tell wp_list_comments()
* to use twentyten_comment() to format the comments.
* If you want to overload this in a child theme then you can
* define twentyten_comment() and that will be used instead.
* See twentyten_comment() in twentyten/functions.php for more.
*/
wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
?>
</ol>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<?php endif; // check for comment navigation ?>
<?php else : // or, if we don't have comments:
/* If there are no comments and comments are closed,
* let's leave a little note, shall we?
*/
if ( ! comments_open() ) :
?>
<p class="nocomments"><?php _e( 'Comments are closed.', 'twentyten' ); ?></p>
<?php endif; // end ! comments_open() ?>
<?php endif; // end have_comments() ?>
<?php if(function_exists('wp_commentnavi')) { wp_commentnavi(); } ?>
<?php comment_form(); ?>
</div><!-- #comments -->
-------------------------------------------------------
2. REPLACE THE BELOW GIVEN CODE INTO "FUNCTIONS.PHP". I CANNOT COPY THE ENTIRE FUNCTIONS.PHP CODE BECAUSE YOUR THEME MIGHT HAVE ADDITIONAL FUNCTIONS WHICH WILL THEN DISAPPEAR. FIND THE FUNCTION FOR COMMENTS... DO A SEARCH TO FIND THAT FUNCTION AND REPLACE THAT FUNCTION ENTIRELY BY FOLLOWING CODE...
if ( ! function_exists( 'twentyten_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own twentyten_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Twenty Ten 1.0
*/
function twentyten_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<?php echo get_avatar( $comment, 40 ); ?>
<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
</div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == '0' ) : ?>
<em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
<br />
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<?php
/* translators: 1: date, 2: time */
printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
?>
</div><!-- .comment-meta .commentmetadata -->
<div class="comment-body"><?php comment_text(); ?></div>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</div><!-- #comment-## -->
<?php
break;
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'twentyten'), ' ' ); ?></p>
<?php
break;
endswitch;
}
endif;
-------------------------------------------------------
3. If you replace the above code of both comments.php and functions.php and test your theme, it should show threads divided into group of 5 (whatever settings you have in WP Admin > Discussion area) and there should be link for "Newer Comments". By default it won't show you numbers like page 1, 2, etc. If you want this functionality... there is an excellent plugin that you will have to install (free of course). The plugin is located at
[[LINK href="http://wordpress.org/extend/plugins/wp-commentnavi/"]]http://wordpress.org/extend/plugins/wp-commentnavi/[[/LINK]]
I HAVE ALREADY INSERTED THE REQUIRED PLUGIN CODE INTO THE NEW COMMENTS.PHP CODE TO MAKE IT WORK. JUST INSTALL THE ABOVE PLUGIN AND ACTIVATE IT. TO CHANGE THE CSS OF THE PLUGIN, INSERT THE FOLLOWING CSS AT THE BEGINNING OF "commentnavi-css.css" WHICH WILL BE LOCATED IN "plugins/wp-commentnavi" folder (after you install the plugin of course)...
.wp-commentnavi {
clear:both;
padding:20px;
}
THIS CSS WILL ENSURE THAT YOUR PAGING NUMBERS APPEAR AFTER THE NUMBER OF COMMENTS AND ABOVE THE COMMENT FORM. YOU CAN ALSO CHANGE THE SETTINGS OF THIS PLUGIN FROM THE WP ADMIN AREA AFTER ITS ACTIVATED UNDER "Settings > WP-CommentsNavi" OPTION.
-------------------------------------------------------
4. If you want me edit your "functions.php", you will have to paste the entire code from that file here as well... I cannot read the code of that file from your theme through a browser.
Let me know if your comments work fine and I look forward to getting paid :-)
Best
Sapan Shah
Jamie Kang comments:
I tried what you said, it really messed with my divs and after 5 comments the site just cuts off and ends, the reply comment box does not show, my sidebar and footer don't show
In Ps comments:
Dear Virendar, I have tried my best to explain how to edit files. Since I don't have access to your FTP, I cannot view each and every php file to ascertain what breaks or doesn't. If I have to do that, it'd be just a normal project and not just question and answer one. I honestly cannot judge why it breaks because many files are dependant on each other and while answering your question I provided you solution for making your comments threading work... not for other resulting css/coding issues. Being a PHP/Database driven system it usually happens that when we make a change to one thing, it affects few other dependencies as well.