aboutsummaryrefslogtreecommitdiff
path: root/srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-07 13:06:14 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-07 13:06:14 +0100
commit7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8 (patch)
treef7453d7dd5cbaaab246e23810b02d3edf1e451be /srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php
parentc59bdcf77c50cbe89b4a93782cdd6d9e7532080e (diff)
downloadft_server-7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8.tar.gz
ft_server-7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8.tar.bz2
ft_server-7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8.zip
Added wordpress
Diffstat (limited to 'srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php')
-rw-r--r--srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php b/srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php
new file mode 100644
index 0000000..b2a6aca
--- /dev/null
+++ b/srcs/wordpress/wp-content/themes/twentytwenty/template-parts/pagination.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * A template partial to output pagination for the Twenty Twenty default theme.
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twenty
+ * @since 1.0.0
+ */
+
+/**
+ * Translators:
+ * This text contains HTML to allow the text to be shorter on small screens.
+ * The text inside the span with the class nav-short will be hidden on small screens.
+ */
+
+$prev_text = sprintf(
+ '%s <span class="nav-prev-text">%s</span>',
+ '<span aria-hidden="true">&larr;</span>',
+ __( 'Newer <span class="nav-short">Posts</span>', 'twentytwenty' )
+);
+$next_text = sprintf(
+ '<span class="nav-next-text">%s</span> %s',
+ __( 'Older <span class="nav-short">Posts</span>', 'twentytwenty' ),
+ '<span aria-hidden="true">&rarr;</span>'
+);
+
+$posts_pagination = get_the_posts_pagination(
+ array(
+ 'mid_size' => 1,
+ 'prev_text' => $prev_text,
+ 'next_text' => $next_text,
+ )
+);
+
+// If we're not outputting the previous page link, prepend a placeholder with visibility: hidden to take its place.
+if ( strpos( $posts_pagination, 'prev page-numbers' ) === false ) {
+ $posts_pagination = str_replace( '<div class="nav-links">', '<div class="nav-links"><span class="prev page-numbers placeholder" aria-hidden="true">' . $prev_text . '</span>', $posts_pagination );
+}
+
+// If we're not outputting the next page link, append a placeholder with visibility: hidden to take its place.
+if ( strpos( $posts_pagination, 'next page-numbers' ) === false ) {
+ $posts_pagination = str_replace( '</div>', '<span class="next page-numbers placeholder" aria-hidden="true">' . $next_text . '</span></div>', $posts_pagination );
+}
+
+if ( $posts_pagination ) { ?>
+
+ <div class="pagination-wrapper section-inner">
+
+ <hr class="styled-separator pagination-separator is-style-wide" aria-hidden="true" />
+
+ <?php echo $posts_pagination; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- already escaped during generation. ?>
+
+ </div><!-- .pagination-wrapper -->
+
+ <?php
+}