Actually, it has been part of WordPress for ages, but hardly anyone knows the nextpage tag. With this function, WordPress articles can be easily split over several pages.
The pagination: this is how it works!
To split your WordPress article over several pages, first switch to the HTML editor. There you enter at a point of your choice
a. This is also where the page break takes place. You can include as many page breaks in your article as you want.
The whole thing also works with a keyboard shortcut in the visual editor.
Alt + Shift + p
is the magic word. In the front end, the article is then distributed over several sub-pages according to your labeling.
Set up references to the subpages
By inserting the nextpage tag, references to the subpages under the article are created in most WordPress themes. If this is not the case or you do not like the link structure of your theme, you can do it yourself.
The function with which you can adjust the sub-page references of an article by default is called
(There is also the link_pages () function. It takes slightly different arguments, but does basically the same thing). The function is passed an array with a number of parameters as an argument.
With the exception of echo, all parameters are of the string type. With before and after you specify what should be in front of and behind the page links. By default, the links are set in an HTML paragraph of text and are listed with the word “Pages”. Especially with German WordPress sites, it makes sense to make a small linguistic adjustment here.
Page numbers à la carte
The parameters link_before and link_after in turn relate to the content that is before or after each individual subpage link. By default these are empty.
determines whether the page information is visualized by numbers or whether the user can use a forward or back link to go to the next or previous page. Accordingly, you can only transfer two valid strings to this variable: “number” (default) and “next”.
The separator parameter determines what is between the individual page numbers. By default, the references are separated by a vertical line.
With nextpagelink and previouspagelink you can determine the link text that leads you to the next or previous page of your WordPress article.
Would you prefer to include the user instead of just numbers?
“Page 1 | Page 2 | …" or
"Part 1 | Part 2 | ... "
Use the variable pagelink to guide you through your article. Use a percent sign to create a placeholder for the page number.
This is how “Page%” becomes:
“Page 1 | Page 2 | … ”
and from “part%”:
“Part 1 | Part 2 | … ”
echo is a Boolean variable and specifies whether the page numbers should be output as a PHP echo or as HTML. The first variant is output by default. For HTML, set echo to 0 (false).
Further layout adjustments via CSS
Of course, fonts, colors and sizes can still be adjusted using CSS. For the sake of simplicity, you can use the class attribute when setting up the links in order to be able to better navigate the individual elements of the pagination later.
The adjustments are then made as usual in the WordPress editor.
Link subpages directly in the article
The references can of course also be integrated within the WordPress article (or other articles and pages) as a normal link. You can call up the sub-pages by entering a slash and the page number after the usual article link, e.g.
In this way, you are no longer limited to the standardized pagination at the bottom of the page, but can use the links as you wish.