I am referencing the WP codex here: https://codex.wordpress.org/Styling_Page-Links but cannot find a way to customize the post URL for page break ( ) feature. For exmaple: instead of the traditional …/post/2/ I would like for it to be called …/post/page2/
here is what I currently have in my themes functions.php file
//Display Number & Next/Previous Links with wp_link_pages
add_filter('wp_link_pages_args','add_next_and_number');
function add_next_and_number($args){
if($args['next_or_number'] == 'next_and_number'){
global $page, $numpages, $multipage, $more, $pagenow;
$args['next_or_number'] = 'number';
$prev = '';
$next="";
if ( $multipage ) {
if ( $more ) {
$i = $page - 1;
if ( $i && $more ) {
$prev .= _wp_link_page($i);
$prev .= $args['link_before']. $args['previouspagelink'] . $args['link_after'] . '</a>';
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
$next .= _wp_link_page($i);
$next .= $args['link_before']. $args['nextpagelink'] . $args['link_after'] . '</a>';
}
}
}
$args['before'] = $args['before'].$prev;
$args['after'] = $next.$args['after'];
}
return $args;
}
add_filter ('the_content', 'pagination_after_post',1);
function pagination_after_post($content) {
if(is_single()) {
$content.= '<nav class="pagination">' .
wp_link_pages(array(
'before' => '' . __('Pages:'),
'after' => '',
'next_or_number' => 'next_and_number',
'nextpagelink' => '<li>'.__('Next'), '</li>',
'previouspagelink' => '<li>'.__('Previous'),'</li>',
'pagelink' => '%',
'echo' => 0 )
);
'</nav>';
}
return $content;
}
Can the URL be changed via the functions.php? Or does this have to do with .htaccess file on apache?