WP Link Pages Extended

View All

In order for the page to be viewed in its entirety instead of being paged, the page source must be modified prior to being displayed in the post or page display. This is handled by the following functions:

This routine fires during post display. First it checks whether the ‘viewall’ parameter is in the URL and then checks the value of the parameter for ‘true’. Then is replaces any appearance of <!--nextpage--> with <hr class="wp-link-pages-extended" style="clear:both;"/> so that the page separations are indicated by horizontal lines.

If there are no pages, then the page links are not shown and there is no way to return to the paged format, unless the routine supplies it. Fortunately there is a solution. The same functionality can be added to the function to display the ‘View Pages’ links. In this situation, only the ‘First’ and ‘Last’ links are included.

During testing, I discovered that in certain situations, the $numpages counter was being reset to 1 after the page or post contents were modified to remove the <!--nextpage--> markers. (I suspect it was the theme doing that.) For that reason, the function also reset the value of the counter the actual number of pages, because otherwise the wp_link_pages() function would not return any links.

Share
The short URL of the present article is: http://www.terryobrien.me/g3w0j

Page 5 of 6
First | Prev | 1 | 2 | 3 | 4 | 5 | 6 | Next | Last
View All