New WordPress Plugin: WP Link Pages Extended

I just released a new WordPress plugin: WP Link Pages Extended. This plugin extends the existing subpage linking mechanism that WordPress uses when the page or post author uses the <!--nextpage--> element to divide the page into subpages; this mechanism is what provides links to the various subpages at the bottom of the page, which is not to be confused with the inter-post link navigation system. I was very dissatisfied with the limited way WordPress by default presented the links, and I wanted something better for my own website, so I was certainly disposed to do something about it.


There are three main areas in which the default subpage navigation system is flawed.

For one, there was no indication of which subpage was on display. The only real way to know that was to either look at the actual URL or check the links at the bottom of the subpage and see which one was not a link, since the subpage linking system would not create a link to the same page: the latter can be very unclear depending on the way the page template uses CSS to display the URL links. I am a strong believer in providing maximal information to the user, and this, along with the overall number of pages, is information that must be provided.

Secondly, the system only allows for two styles of links: a series of links to the numeric pages and a set of Previous / Next links. Using the former when trying to navigate between successive subpages means having to check to see exactly which subpage is displayed, a difficult task given the previous paragraph, in order to page quickly and sequentially between subpages. Using the latter means losing knowing which subpage is actually being displayed and the ability to select the desired subpage at will: in addition, it does not allow for any way to go directly to the first or last subpage when desired. A well-designed subpage navigation system would allow for all of these.

Finally, there was no way of forcing the display the entire page without subpages. Sometimes the viewer would want to see the entire page, such as when they want to print the entire page, and some mechanism to allow that should be available.


What I wanted was something like the following image, taken from the page for my short story ‘Promotions’.


Note: the outline shown here was added to highlight the image and does not appear in the actual link as displayed.

What this shows is a subpage number and count, both the First / Last and Previous / Next links and all of the subpage links and a way to view all subpages as a single page. The code to provide all of this was relatively very simple to write. WordPress provides a large number of hooks into its system, and one of them allows for the manipulation of the parameters into the routine that generates the subpage links. While the functionality of this specific hook is quite generic, with some creative coding, the result can be seen above.

More information on the plugin, especially the coding involved, can be found on my page WP Link Pages Extended.

The short URL of the present article is:

Comments are closed.