Mechanics
The mechanics of this plugin uses the filter wp_link_pages_args
which triggers a defined function. The function is called with the default parameters used by the wp_link_pages()
function as determined by the theme.
1 | add_filter( ‘wp_link_pages_args’, ‘wp_link_pages_extended_args’ ); |
Inside the wp_link_page_extended_args()
function, after a simple logic test to determine whether the post or page being displayed requires the pagination navigation, an array is defined to be used by the wp_link_pages()
function to replace the default definitions. The parameters definitions are described under the Codex reference for the wp_link_pages_args
filter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $args = array( ‘next_or_number’ => ‘number’, // keep numbering for the main part ‘pagelink’ => ‘%’, // Simple numeric output ‘separator’ => ’ | ‘, // Space out the alpha and numeric entries ‘echo’ => 1, // Echo the full output ‘before’ => ”, // Initialized here, used later ‘after’ => ”, // Initialized here, used later ‘link_before’ => ”, // Not used, included for completeness ‘link_after’ => ”, // Not used, included for completeness ‘nextpagelink’ => __( ‘Next’, ‘wp-link-pages-extended’ ), ‘previouspagelink’ => __( ‘Prev’, ‘wp-link-pages-extended’ ), ‘firstpagelink’ => __( ‘First’, ‘wp-link-pages-extended’ ), // Not standard ‘lastpagelink’ => __( ‘Last’, ‘wp-link-pages-extended’ ), // Not standard ‘viewalllink’ => __( ‘View All’, ‘wp-link-pages-extended’ ), // Not standard ‘viewpagelink’ =? __( ‘View Pages’, ‘wp-link-pages-extended’ ), // Not standard ); |
The intent here is to use the standard numeric pagination navigation system but augment it by using the ‘before’ and ‘after’ array elements to surround the numeric navigation system with not only the text navigation system but also the page information. ‘link_before’ and ‘link_after’ are used for prepending and appending text to the page number and is not used in this situation: they are included in this function for completeness.
Note that internationalization was used for the definitions of the link titles.
Personal Links
My Amazon Wishlist
My DeviantArt Gallery
My Facebook Page
My Goodreads Bookshelf
My Smashwords Catalog
My Twitter Feed
My WordPress Profile