{"id":2741,"date":"2012-10-26T21:39:49","date_gmt":"2012-10-26T21:39:49","guid":{"rendered":"http:\/\/www.dognmonkey.com\/techs\/?p=2741"},"modified":"2018-01-31T14:13:18","modified_gmt":"2018-01-31T22:13:18","slug":"how-to-use-wp-pagenavi-and-wp-commentnavi-plugins","status":"publish","type":"post","link":"https:\/\/www.dognmonkey.com\/techs\/how-to-use-wp-pagenavi-and-wp-commentnavi-plugins.html","title":{"rendered":"How To Use WP-PageNavi And WP-CommentNavi Plugins"},"content":{"rendered":"<p style=\"text-align: center;\"><em>I&#8217;ve been looking ways to paginate my main page posts list, singles, pages and comments, I couldn&#8217;t find any answers until I studied about the plugins from\u00a0 <a title=\"Lester Chan - GamerZ profile\" href=\"\/\/profiles.wordpress.org\/GamerZ\/\" target=\"_blank\">Lester Chan-GamerZ<\/a> , among those, <a title=\"wp-pagenavi plugin\" href=\"\/\/wordpress.org\/extend\/plugins\/wp-pagenavi\/\" target=\"_blank\">WP-PageNavi<\/a> and <a title=\"wp-commentnavi plugin\" href=\"\/\/wordpress.org\/extend\/plugins\/wp-commentnavi\/\">WP-CommentNavi<\/a>, I finally found the way to use them for paginate my pages, posts and comments. This is the way I use them with Mono-lab themes: Flat and PianoBlack.<\/em><\/p>\n<p style=\"text-align: center;\"><em>If we&#8217;re using WordPress 3.4.2, most of these pagination php are already embedded in the system and called out somewhere in our themes, all we need is to find where to place these plugins codes. For blog main page posts pagination, we need to have excerpts turned on and working. The theme files that need to implement with WP-PageNavi codes are: index.php, archive.php and search.php.<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><em>For Single Post pagination, by using &#8220;next-page&#8221; while editing, the theme files that need to implement with WP-PageNavi are: single.php and page.php.<\/em><\/p>\n<p style=\"text-align: center;\"><strong><em>MAIN PAGE POSTS LIST PAGINATION WITH EXCERPTS<\/em><\/strong><\/p>\n<p style=\"text-align: center;\"><a class=\"preview\" title=\"Main Page Posts list with pagenavi\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi8.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"Main Page Posts list with pagenavi\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi8.jpg\" alt=\"main\" width=\"250\" height=\"163\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Well, we need to install the plugin WP-PageNavi first, activate it and modify some settings if we want, I only modify &#8220;&lt;&lt;&#8221; and &#8220;&gt;&gt;&#8221; with &#8220;&lt;&lt; Previous&#8221; and &#8220;Next &gt;&gt;&#8221;<\/em><\/p>\n<p style=\"text-align: center;\"><a class=\"preview\" title=\"Settings - select PageNavi plugin\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi5.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"Settings - select PageNavi plugin\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi5.jpg\" alt=\"\" width=\"196\" height=\"250\" \/><\/a>\u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" title=\"Modify settings if neccessary\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"Modify settings if neccessary\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi.jpg\" alt=\"main\" width=\"250\" height=\"240\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Save &#8220;settings&#8221; and open &#8220;index.php&#8221;, &#8220;archive.php&#8221; and &#8220;search.php&#8221; to search and replace codes with pagenavi codes. We need to search for &#8220;pager&#8221; and we should find these lines in these files. The if options &#8216;pager&#8217; is for paginate when we have many posts with excerpts on the same page (which number of posts is set in settings-reading).<\/em><\/p>\n<p style=\"text-align: center;\"><em><a class=\"preview\" title=\"find if option 'pager'\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi6.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"find if option 'pager'\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi6.jpg\" alt=\"pager\" width=\"250\" height=\"56\" \/><\/a> \u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" title=\"replace with pagenavi codes\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi10.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"replace with pagenavi codes\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi10.jpg\" alt=\"pager\" width=\"250\" height=\"60\" \/><\/a><\/em><\/p>\n<p style=\"text-align: center;\"><em>In PianoBlack theme, the main page pagination was used with &#8220;navigation.php&#8221;, we need to remove the include statement, your theme may not have this &#8220;navigation.php&#8221;.<\/em><\/p>\n<p style=\"text-align: center;\"><em>Now we should have main page with post listed with WP-PageNavi plugin. I modified the pagenavi-css.css in the plugins\/wp-pagenavi\/ with some borders and background.<\/em><\/p>\n<blockquote>\n<p style=\"text-align: left;\"><em><\/em>.wp-pagenavi {<br \/>\nclear: both;<br \/>\nmargin-bottom:40px;<br \/>\nmargin-top:30px;<br \/>\n}<\/p>\n<p>.wp-pagenavi a, .wp-pagenavi span {<br \/>\ntext-decoration: none;<br \/>\nborder: 1px solid #333;<br \/>\npadding: 10px 15px;<br \/>\n-moz-border-radius:3px; -khtml-border-radius:3px; -webkit-border-radius:3px; border-radius:3px;<br \/>\nbackground:#101010;<br \/>\n}<\/p>\n<p>.wp-pagenavi a:hover, .wp-pagenavi span.current {<br \/>\nborder-color: #000;<br \/>\n}<\/p>\n<p>.wp-pagenavi span.current {<br \/>\nfont-weight: bold;<br \/>\n}<\/p><\/blockquote>\n<p style=\"text-align: center;\"><em><\/em><strong><em>WP-PAGENAVI WITH LONG SINGLE POST &#8211; PAGE PAGINATION<\/em><\/strong><\/p>\n<p style=\"text-align: center;\"><strong><em><\/em><\/strong><em>If we have long posts with many &#8220;next-page&#8221; inserts, we want to display with WP-PAGENAVI, all we need to do is to replace all &#8216;&lt;?php wp_link_pages(); ?&gt;&#8217; with &#8216;&lt;?php wp_pagenavi( array( &#8216;type&#8217; =&gt; &#8216;multipart&#8217; ) ); ?&gt;&#8217; in &#8220;single.php&#8221; and &#8220;page.php&#8221; of your themes.<\/em><\/p>\n<blockquote>\n<p style=\"text-align: left;\"><em>&lt;?php wp_pagenavi( array( &#8216;type&#8217; =&gt; &#8216;multipart&#8217; ) ); ?&gt;<\/em><\/p>\n<\/blockquote>\n<p style=\"text-align: center;\"><em><\/em><a class=\"preview\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi1.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"replace link_pages\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi1.jpg\" alt=\"links\" width=\"250\" height=\"41\" \/><\/a>\u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi2.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"replace with pagenavi codes\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi2.jpg\" alt=\"\" width=\"250\" height=\"42\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Now, we should have both Main page posts list and long single post-page paginated with WP-PageNavi plugin.<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><a class=\"preview\" title=\"single post pagenavi\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi3.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"single post pagenavi\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi3.jpg\" alt=\"single\" width=\"250\" height=\"106\" \/><\/a>\u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" title=\"main posts list with pagenavi\" href=\"\/media\/wpplugins\/paginate\/sm_pagenavi9.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"main posts list with pagenavi\" src=\"\/media\/wpplugins\/paginate\/tn_pagenavi9.jpg\" alt=\"main posts list with pagenavi\" width=\"250\" height=\"134\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong><em>WP-COMMENTNAVI FOR COMMENT.PHP<\/em><\/strong><\/p>\n<p style=\"text-align: center;\"><strong><em><\/em><\/strong><em>Again, install WP-CommentNavi plugin, activate, and go to settings &#8211; commentnavi &#8211; to modify anything you like.<\/em><\/p>\n<p style=\"text-align: center;\"><a class=\"preview\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi5.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"settings commentnavi\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi5.jpg\" alt=\"settings\" width=\"196\" height=\"250\" \/><\/a>\u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi6.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"modify settings\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi6.jpg\" alt=\"commentnavi\" width=\"187\" height=\"250\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Now, open &#8220;comments.php&#8221; of your theme and search for &#8216;pager&#8217; again, for this to work, we have to turn on the option in &#8220;discussion&#8221;<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><a class=\"preview\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi7.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"turn on comment pagination in discussion\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi7.jpg\" alt=\"discussion\" width=\"250\" height=\"243\" \/><\/a>\u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi8.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"turn on and set number of comments for pagination\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi8.jpg\" alt=\"comments\" width=\"250\" height=\"65\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>Dependent upon how your comments.php in your theme is written, you should be able to find &#8216;pager&#8217; and &#8216;paginate_comment_link()&#8217;, delete this line and place the commentnavi codes below the comment_pager<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><a class=\"preview\" title=\"search for paginate_comments_link\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"search for paginate_comments_link\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi.jpg\" alt=\"links\" width=\"250\" height=\"88\" \/><\/a>\u00a0\u00a0\u00a0\u00a0 <a class=\"preview\" title=\"replace with commentnavi codes\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi1.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"replace with commentnavi codes\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi1.jpg\" alt=\"commentnavi\" width=\"250\" height=\"83\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>In PianoBlack theme, I had to delete the &#8216;}}&#8217; after delete &#8220;paginate_comment_link&#8221; and added the commentnavi codes.<\/em><\/p>\n<blockquote>\n<p style=\"text-align: left;\"><em><\/em>&lt;?php if(function_exists(&#8216;wp_commentnavi&#8217;)) { wp_commentnavi(); } ?&gt;<\/p>\n<\/blockquote>\n<p style=\"text-align: center;\"><em>Now we should have comments paginated with WP-CommentNavi plugin<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><a class=\"preview\" title=\"comments paginated with commentnavi\" href=\"\/media\/wpplugins\/paginate\/sm_commentnavi3.jpg\" rel=\"lightbox[pagenavi]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"comments paginated with commentnavi\" src=\"\/media\/wpplugins\/paginate\/tn_commentnavi3.jpg\" alt=\"commentnavi\" width=\"250\" height=\"111\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>I did modify the commentnavi-css.css in the plugins\/wp-commentnavi\/<\/em><\/p>\n<blockquote>\n<p style=\"text-align: left;\"><em><\/em>.wp-commentnavi a, .wp-commentnavi a:link {<br \/>\npadding: 10px 15px;<br \/>\nmargin: 2px;<br \/>\ntext-decoration: none;<br \/>\nborder: 1px solid #ff9966;<br \/>\ncolor: #120000;<br \/>\nbackground-color: #ffddbb;\u00a0\u00a0 \u00a0-moz-border-radius:3px; -khtml-border-radius:3px; -webkit-border-radius:3px; border-radius:3px;<br \/>\n}<br \/>\n.wp-commentnavi a:visited {<br \/>\npadding: 10px 15px;<br \/>\nmargin: 2px;<br \/>\ntext-decoration: none;<br \/>\nborder: 1px solid #ffddbb;<br \/>\ncolor: #120000;<br \/>\nbackground-color: #ff9966;<br \/>\n}<br \/>\n.wp-commentnavi a:hover {<br \/>\nborder: 1px solid #800517;<br \/>\ncolor: #800517;<br \/>\nbackground-color: #ffddbb;<br \/>\n}<br \/>\n.wp-commentnavi a:active {<br \/>\npadding:10px 15px;<br \/>\nmargin: 2px;<br \/>\ntext-decoration: none;<br \/>\nborder: 1px solid #ff9966;<br \/>\ncolor: #800517;<br \/>\nbackground-color: #ffddbb;<br \/>\n}<br \/>\n.wp-commentnavi span.pages {<br \/>\npadding: 10px 15px;<br \/>\nmargin: 2px;<br \/>\ncolor: #800517;<br \/>\nborder: 1px solid #ff9966;<br \/>\nbackground-color: #ffddbb;-moz-border-radius:3px; -khtml-border-radius:3px; -webkit-border-radius:3px; border-radius:3px;<br \/>\n}<br \/>\n.wp-commentnavi span.current {<br \/>\npadding: 10px 15px;<br \/>\nmargin: 2px;<br \/>\nfont-weight: bold;<br \/>\n\/*\u00a0\u00a0 \u00a0border: 1px solid #000000;*\/<br \/>\ncolor: #800517;<br \/>\nbackground-color: #ffddbb;-moz-border-radius:3px; -khtml-border-radius:3px; -webkit-border-radius:3px; border-radius:3px;<br \/>\n}<br \/>\n.wp-commentnavi span.extend {<br \/>\npadding: 10px 15px;<br \/>\nmargin: 2px;<br \/>\nborder: 1px solid #ff9966;<br \/>\ncolor: #120000;<br \/>\nbackground-color: #ffddbb;<br \/>\n}<br \/>\n.wp-commentnavi-all-comments-link {<br \/>\n}<\/p>\n<\/blockquote>\n<p style=\"text-align: center;\"><em>I&#8217;ve been searching for many days to get these things to work and none of them really show much of anything. Hope these will work on your theme as they work on mine. I have tested these plugins with list category posts with pagination and they don&#8217;t work together, the pageviews came out wrong. My next one is to get category post list to paginate. If you see any problems, please let me know so we can figure it out together.<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><em>Cheers,<\/em><\/p>\n<p style=\"text-align: center;\"><em><\/em><ul class=\"lcp_catlist\" id=\"lcp_instance_0\"><\/ul><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been looking ways to paginate my main page posts list, singles, pages and comments, I couldn&#8217;t find any answers until I studied about the plugins from\u00a0 Lester Chan-GamerZ , among those, WP-PageNavi and WP-CommentNavi, I finally found the way to use them for paginate my pages, posts and comments. This is the way I <a href=\"https:\/\/www.dognmonkey.com\/techs\/how-to-use-wp-pagenavi-and-wp-commentnavi-plugins.html\" class=\"more-link\">&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,20],"tags":[265,267,266,812,262,261],"class_list":["post-2741","post","type-post","status-publish","format-standard","hentry","category-plugins","category-wordpress","tag-paginate-comments","tag-paginate-pages","tag-paginate-singles","tag-wordpress","tag-wp-commentnavi","tag-wp-pagenavi"],"views":3978,"_links":{"self":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts\/2741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/comments?post=2741"}],"version-history":[{"count":4,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts\/2741\/revisions"}],"predecessor-version":[{"id":6852,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts\/2741\/revisions\/6852"}],"wp:attachment":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/media?parent=2741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/categories?post=2741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/tags?post=2741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}