i know this is a tricky question.
I’ve got the following permalink structure in my wordpress site:
http://www.domain.com/articleName/
My articles are paginated so there are previous and next page links at the bottom of my article. When you are on the first page of my articel the next page buttons leads to ,,domain.com/articleName/2″.
I’ve programmed continuing page numbers for all articles. E.g. my first article got 20 pages, the second articel starts at page 21. The page number link at the bottom of my article starts with 21 and then 22 etc. But the permalink shows ,,domain.com/articleName/2″ instead of ,,domain.com/articleName/22″.
Does anyone know where or how i can change the starting number for the pagination?
Or is there another way to manipulate the page number in the URL? With hooks or something?
The /2 on the end of the url in the archive page is for the second page of n results. eg if you have 22 set as the number of posts per blog page and ‘post name’ set as the permalink structure, then page 1 (domain.com/category) will contain posts 1-22 and page 2 (domain.com/category/2) will contain posts 23-45
You can set the number of results per archive page in:
There are different ways that wordpress handles pagination in the code though: the wordpress codex has a number of functions you can use – I use
and
which generate the correct type of links in your archive pages based on your permalink settings in
if you want the links in your single.php (the actual post page) to link to the next post and previous post, then you can use
and
** note the difference between posts and post
There are also paginated posts (eg if a post is spread over more than one page itself – using the
comment )
for these types of pages, the /2 or /22 on the end relates to the page of the post –
eg page 22 of a post, rather that page 22 of the archive – in this case, your first post (domain.com/article) has 22 pages – so goes to domain.com/article/22,
but your second post doesnt start at domain.com/article/23, it starts at domain.com/secondarticle and goes for 20 pages until domain.com/secondarticle/20