Sunday, August 12, 2012

Add Comment's Pagination in Wordpress without any Plugin

Comment's Pagination help you to load your site if there are a lot of comment in any blog post. There are many Wordpress plugin to do this. But sometimes it don't shows what you want. But now I am shearing a tricks to do this without any plugin.
Lets start..

LogIn to your account and go to comments.php
Now find this default code below:
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
 Place this code after this:
<div class="paginate">
<?php
//Create pagination links for the comments on the current post
paginate_comments_links( array('prev_text' => '&lsaquo; New comment', 'next_text' => 'Old comment  &rsaquo;'));
?>
</div>
N.B: If you don't find default code then place above commentlist code.

Generally "commentlist" code is like:
<ol class="commentlist">
    <?php wp_list_comments('avatar_size=64&style=ol'); ?>
    </ol>
Now place this code in style.css :
.paginate {
margin: 10px 0 20px 0;
padding: 5px 1px 5px;
text-align: center;
font-family: Arial, Helvetica, sans-serif, SolaimanLipi;
}
.paginate a {
padding: 3px 6px 4px 6px;
margin: 3px;
text-decoration: none;
border: 1px solid #ccc;
color: #666;
background-color: inherit;
font-family: Arial, Helvetica, sans-serif, SolaimanLipi;
}
.paginate a:hover {
border: 1px solid #444;
color: #444;
background-color: #eee;
}
.paginate .current {
padding: 3px 6px 4px 6px;
margin: 3px;
font-weight:bold;
border: 1px solid #666;
color: #444;
background-color: #eee;
}
 Now go to Dashboard > Settings > Discussion Settings
Then chose the value of Break comments into pages with top level comments per page and the page displayed by default as you like.

[Please comment for any Problem]

No comments:

Post a Comment

!! COMMENT HERE FOR ANY PROBLEM !!

Featured post

WordPress yoast plugin remove date or article:published_time

Yoast is an essential plugin for WordPress SEO. It is one of the best SEO plugin for wordpress right now. But, after disabling date from ...