Pagination in Shifter

Pagination in Shifter Shifter retrieves pagination links for “pages” or “posts” for which the is_single() function returns true from the results of the wp_link_pages() function. Shifter lists the URLs that should be generated based on the results of the wp_link_pages(). Shifter also generates pagination for “Pages” that have a wp_link_pages()

function. Generating Pagination

  • For “Pages” or “Posts” where is_single()
  • returns true, the URLs generated from the results of the wp_link_pages()

For pages with templates that have page links added programmatically, the `wp_link_pages()` function does not create page links in this case. You must use the `wp_link_pages` filter hook to create pagination links.

  • Reference: Sample code at line #L856 of post-template.php in tags/4.9.2/src/wp-includes

Since this filter hook affects line #L938 of post-template.php in tags/4.9.2/src/wp-includes in post-template.php at line #L938, so please use the wp_link_pages

filter hook. Sample Code

add_filter( 'wp_link_pages', function( $output, $args ){
    // write some code here for modifying $output when the Page.
    return $output;
}, 10, 2 );