Added wrapper for paginate_links function
Only adds a tabindex for the dots right now, which was done with JS before and that was bad.
This commit is contained in:
parent
64bb7653fc
commit
9885b47efd
@ -211,7 +211,7 @@ $tabs[ $current_tab ]['classes'][] = '_current';
|
||||
|
||||
// Output pagination
|
||||
if ( $pag_args['total'] > 1 ) {
|
||||
echo '<li class="pagination">' . paginate_links( $pag_args ) . '</li>';
|
||||
echo '<li class="pagination">' . fictioneer_paginate_links( $pag_args ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
@ -1207,7 +1207,7 @@ function fictioneer_shortcode_blog( $attr ) {
|
||||
}
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
<nav class="pagination"><?php echo paginate_links( $pag_args ); ?></nav>
|
||||
<nav class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></nav>
|
||||
</section>
|
||||
<?php // <--- End HTML
|
||||
} else {
|
||||
|
@ -1073,4 +1073,29 @@ function fictioneer_removable_args( $args ) {
|
||||
}
|
||||
add_filter( 'removable_query_args', 'fictioneer_removable_args' );
|
||||
|
||||
// =============================================================================
|
||||
// PAGINATION
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Modifies the pagination links output for the theme
|
||||
*
|
||||
* @since Fictioneer 5.4.0
|
||||
* @link https://developer.wordpress.org/reference/functions/paginate_links/
|
||||
*
|
||||
* @param array $args Optional. Array of arguments for generating the pagination links.
|
||||
*
|
||||
* @return string Modified pagination links HTML.
|
||||
*/
|
||||
|
||||
function fictioneer_paginate_links( $args = [] ) {
|
||||
$pagination = paginate_links( $args );
|
||||
|
||||
return str_replace(
|
||||
'class="page-numbers dots"',
|
||||
'class="page-numbers dots" tabindex="0"',
|
||||
$pagination
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -70,7 +70,7 @@ if ( ! function_exists( 'fictioneer_chapters_list' ) ) {
|
||||
?>
|
||||
|
||||
<?php if ( $args['chapters']->max_num_pages > 1 ) : ?>
|
||||
<li class="pagination"><?php echo paginate_links( $pag_args ); ?></li>
|
||||
<li class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
@ -72,7 +72,7 @@ if ( ! function_exists( 'fictioneer_collections_list' ) ) {
|
||||
?>
|
||||
|
||||
<?php if ( $args['collections']->max_num_pages > 1 ) : ?>
|
||||
<li class="pagination"><?php echo paginate_links( $pag_args ); ?></li>
|
||||
<li class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
@ -214,7 +214,7 @@ if ( ! function_exists( 'fictioneer_collection_featured_list' ) ) {
|
||||
|
||||
// Render pagination if necessary
|
||||
if ( $args['max_pages'] > 1 ) {
|
||||
?><li class="pagination"><?php echo paginate_links( $pag_args ); ?></li><?php
|
||||
?><li class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></li><?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -70,7 +70,7 @@ if ( ! function_exists( 'fictioneer_recommendations_list' ) ) {
|
||||
?>
|
||||
|
||||
<?php if ( $args['recommendations']->max_num_pages > 1 ) : ?>
|
||||
<li class="pagination"><?php echo paginate_links( $pag_args ); ?></li>
|
||||
<li class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
@ -138,7 +138,7 @@ if ( ! function_exists( 'fictioneer_stories_list' ) ) {
|
||||
?>
|
||||
|
||||
<?php if ( $args['stories']->max_num_pages > 1 ) : ?>
|
||||
<li class="pagination"><?php echo paginate_links( $pag_args ); ?></li>
|
||||
<li class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
@ -50,7 +50,7 @@
|
||||
);
|
||||
|
||||
if ( $GLOBALS['wp_query']->found_posts > get_option( 'posts_per_page' ) ) {
|
||||
?><li class="pagination"><?php echo paginate_links( $pag_args ); ?></li><?php
|
||||
?><li class="pagination"><?php echo fictioneer_paginate_links( $pag_args ); ?></li><?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
@ -27,7 +27,7 @@
|
||||
?>
|
||||
</section>
|
||||
|
||||
<nav class="pagination _padding-top padding-bottom"><?php echo paginate_links( $pag_args ); ?></nav>
|
||||
<nav class="pagination _padding-top padding-bottom"><?php echo fictioneer_paginate_links( $pag_args ); ?></nav>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
|
@ -126,7 +126,7 @@ $hook_args = array(
|
||||
);
|
||||
?>
|
||||
</ul>
|
||||
<nav class="pagination _padding-top"><?php echo paginate_links( $pag_args ); ?></nav>
|
||||
<nav class="pagination _padding-top"><?php echo fictioneer_paginate_links( $pag_args ); ?></nav>
|
||||
</section>
|
||||
<?php else : ?>
|
||||
<section class="search-results__no-results"><?php do_action( 'fictioneer_search_no_results' ); ?></section>
|
||||
|
@ -190,7 +190,7 @@ $tabs[ $current_tab ]['classes'][] = '_current';
|
||||
|
||||
// Output pagination
|
||||
if ( $pag_args['total'] > 1 ) {
|
||||
echo '<li class="pagination">' . paginate_links( $pag_args ) . '</li>';
|
||||
echo '<li class="pagination">' . fictioneer_paginate_links( $pag_args ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
@ -1167,9 +1167,6 @@ function fcn_inlineToggleCheckmark(storyId, type = 'story', chapter = null, mode
|
||||
|
||||
function fcn_bindPageNumberJumps() {
|
||||
_$$('.page-numbers.dots').forEach(element => {
|
||||
// Add tabIndex to dots (yes, does not belong here, bla bla)
|
||||
// element.tabIndex = 0;
|
||||
|
||||
// Prompt for desired page number
|
||||
element.addEventListener(
|
||||
'click',
|
||||
|
Loading…
x
Reference in New Issue
Block a user