Is it possible to start post pagination count at zero instead of 1? I want the URLs to be like this:
../page (Foreword)
../page/1 (Chapter 1)
../page/2 (Chapter 2)
But by default the URL is not corresponding to my chapter numbers:
../page (Foreword)
../page/2 (Chapter 1)
../page/3 (Chapter 2)
Is it possible to start post pagination count at zero instead of 1? I want the URLs to be like this:
../page (Foreword)
../page/1 (Chapter 1)
../page/2 (Chapter 2)
But by default the URL is not corresponding to my chapter numbers:
../page (Foreword)
../page/2 (Chapter 1)
../page/3 (Chapter 2)
The ../page/X structure ties to pagination, not to post names. I'm sure you could change them but I'm not sure how deep the effects of the change would be.
Have you thought about an alternate solution?
Name each post your chapter name
Add a plugin that adds previous / next navigation functionality each individual post. Something like WP Post Navigation. That way, when someone finishes reading the first chapter, there will be a link to navigate to the next.
You could change your url structure to fit your needs. For example, if you wanted the structure to look like http://yoursite.com/forward
, http://yoursite.com/chapter-1
, etc. you'd just have to change the permalink settings to 'post name' (Admin > Settings > Permalinks).
it is possible to start post pagination count at zero
instead of 1 in WP. You can achieve this by customizing the pagination links generated by Wordpress
add code below your functions.php file
function custom_pagination_rewrite_rules($rules) {
$new_rules = array(
'page/0?$' => 'index.php?paged=0',
'page/(\d+)/?$' => 'index.php?paged=$matches[1]'
);
return $new_rules + $rules;
}
add_filter('rewrite_rules_array', 'custom_pagination_rewrite_rules');
function custom_pagination_paged($paged) {
if (get_query_var('paged') == 0) {
return 0;
} else {
return $paged;
}
}
add_filter('get_query_var_paged', 'custom_pagination_paged');
I have the same problem too. The only solution I could find is to put the foreword/introduction and chapter one in the first part, then press ALT+SHIFT+P to start the pagination.
This ensured that page 2 has chapter 2.
The problem with this solution is that page 1 is very very long.
If you type in the address page/0
, you will go to the main page: page/
I am sure I have seen sites that start pagination at "0", and "0" even appears in the pagination, but I can't find any source to explain how to do so.