It appears I’ve discovered the best way to make WordPress default gallery pagination to work and to have management over URL forming: Pagination with WordPress default gallery? However when gallery name is in submit.
When gallery name is in web page, it really works provided that URL is like this: area.com/pagename/web page/2/, area.com/pagename/web page/3/ and so on. Attempting to have a unique URL results in stopping it to work.
The a part of code dealing with pagination in capabilities.php:
// Pagination Setup
$present = (get_query_var('paged')) ? get_query_var( 'paged' ) : 1;
$per_page = 3;
$offset = ($current-1) * $per_page;
$large = 999999999;
$complete = sizeof($attachments);
$total_pages = spherical($complete/$per_page);
if( $total_pages < ( $complete/$per_page ) ){
$total_pages = $total_pages+1;
}
// Pagination output
$output .= paginate_links( array(
'base' => str_replace($large,'%#%',esc_url(get_pagenum_link($large))),
'format' => '?paged=%#%',
'present' => $present,
'complete' => $total_pages,
'prev_text' => __('«'),
'next_text' => __('»')
) );
So long as I preserve URL like this area.com/pagename/web page/2/ , different methods for ‘base’ additionally work:
'base' => get_permalink( $post->post_parent ) . '%_%',
'format' => 'web page/%#%/',
And like this:
'base' => get_pagenum_link( 1 ) . '%_%',
'format' => 'web page/%#%/',
However once I strive another URL scheme:
'base' => get_permalink( $post->post_parent ) . '%_%',
'format' => 'paging-%#%',
pagination stops working.
The filter with rewrite tag and rule:
add_filter('init', 'post_gallery_add_rewrite_tag_rule_2022');
perform post_gallery_add_rewrite_tag_rule_2022() {
add_rewrite_tag('%present%','(.+)');
add_rewrite_rule('(.+)/paging-/?([0-9]{1,})/?$', 'index.php?title=$matches[1]&paged=$matches[2]', 'high');
}
It looks like add_rewrite_rule will not be functioning when gallery name is in web page? Or what? Any concepts?