Before
The first element added to the ‘before’ array element is the surrounding <div>
and <p>
definitions.
1 2 | $args[ ‘before’ ] .= ‘<div style=“clear:both; display:block; text-align: center;” >’; $args[ ‘before’ ] .= ‘<p class=“post-pagination”>’; |
This clears out any columns defined through the page template and positions the whole pagination navigation element in the center of the page.
Next the page number and page count element is appended to the element to be displayed above the actual pagination navigation display.
1 2 | $args[ ‘before’ ] .= sprintf( ‘%s %d %s %d’, __( ‘Page’, ‘wp-link-pages-extended’ ), $page, __( ‘of’, ‘wp-link-pages-extended’ ), $numpages ); $args[ ‘before’ ] .= ‘<br />’; |
‘$page’ and ‘$numpages’ are global variables defined earlier in the function. ‘$page’ is the current page number and ‘$numpages’ is the total number of pages. Note that the words ‘Page’ and ‘of’ are internationalized.
Finally the ‘First’ and ‘Prev’ page links are defined, depending on whether or not the current page is the first page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | if ( 1 === $page ) { $args[ ‘before’ ] .= $args[ ‘firstpagelink’ ]; $args[ ‘before’ ] .= $args[ ‘separator’ ]; $args[ ‘before’ ] .= $args[ ‘previouspagelink’ ]; $args[ ‘before’ ] .= $args[ ‘separator’ ]; } else { $args[ ‘before’ ] .= _wp_link_page( 1 ) . $args[ ‘firstpagelink’ ] . ‘</a>’; $args[ ‘before’ ] .= $args[ ‘separator’ ]; $args[ ‘before’ ] .= _wp_link_page( $page - 1 ) . $args[ ‘previouspagelink’ ] . ‘</a>’; $args[ ‘before’ ] .= $args[ ‘separator’ ]; } |
‘firstpagelink’ is defined locally here and is not part of the overall array specification.
Personal Links
My Amazon Wishlist
My DeviantArt Gallery
My Facebook Page
My Goodreads Bookshelf
My Smashwords Catalog
My Twitter Feed
My WordPress Profile