Options > Number Of Pages To Show — no 'auto' option?
As a brief disclaimer, I followed the instructions on this page to make PageNavi play well with the Magazeen theme. The net effect of this is that I added the following lines to PageNavi’s core.php starting at line 32:
if (preg_match("#/page/([1-9]|[1-9][0-9]|[1-9][0-9][0-9])?/#i", $_SERVER["REQUEST_URI"], $matches)) $paged = $matches; else $paged = 1; $posts_per_page = 4; // the number of posts I happen to have specified in my index.php loop
Pagination mechanism works fine — root, /page/2, page/3, etc all display the posts they should.
My problem is that from the plugin options under the Dashboard’s Settings, I have to specify an integer of number of pages to show. Surely this should be derived by the total number of posts divided by the number of posts per page, and not some arbitrary hard-coded setting?
Setting, for example, 4 currently gives links to pages with no content. Setting 1 displays only one page link when there are 2. Leaving the field blank defaults to 0, which in practice outputs
« 2 1 » for page 1 and
« 3 2 » for page 2.
I’m wary of further hacking into the actual plugin core for what seems like bare-bones essential functionality for a pagination plugin.
Am I missing a trick?
- The topic ‘Options > Number Of Pages To Show — no 'auto' option?’ is closed to new replies.