Created
March 28, 2022 09:33
-
-
Save annelyse/b51f3760d461f64effd81677bd739c9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| global $wp_query; | |
| $currentPage = get_query_var('paged'); | |
| $total = $wp_query->max_num_pages; | |
| // si il n'y a pas de page | |
| if( !$currentPage) { | |
| $currentPage = 1; | |
| } | |
| $next = $currentPage + 1; | |
| if( $currentPage == $total ){ | |
| $next = $currentPage ; | |
| } | |
| $prev = $currentPage - 1; | |
| if( $currentPage == 1 ){ | |
| $currentPage = 1; | |
| } | |
| ?> | |
| <div class="pagination pagination-fraction"> | |
| <span>Page suivante</span> | |
| <a href="<?php echo get_pagenum_link($prev) ?>"><</a> | |
| <span><?php echo $currentPage; ?></span> / | |
| <span><?php echo $wp_query->max_num_pages ?></span> | |
| <a href="<?php echo get_pagenum_link($next) ?>">></a> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment