1. Home
  2. /
  3. Forum

Forum

WordPress Paginatio...
 
Notifications
Clear all

WordPress Pagination call with function call twenty_twenty_one_the_posts_navigation()

2 Posts
1 Users
0 Reactions
671 Views
(@devsam)
Member Admin
Joined: 5 years ago
Posts: 18
Topic starter  
if ( ! function_exists( 'twenty_twenty_one_the_posts_navigation' ) ) {
	/**
	 * Print the next and previous posts navigation.
	 *
	 * @since Twenty Twenty-One 1.0
	 *
	 * @return void
	 */
	function twenty_twenty_one_the_posts_navigation() {
		the_posts_pagination(
			array(
				/* 'before_page_number' => ' ', */
				'mid_size'           => 2,
				'prev_text'          => sprintf(
					'%s <span class="nav-prev-text">%s</span>',
					is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ),
					wp_kses(
						__( '<span class="nav-short">Previous</span>', 'twentytwentyone' ),
						array(
							'span' => array(
								'class' => array(),
							),
						)
					)
				),
				'next_text'          => sprintf(
					'<span class="nav-next-text">%s</span> %s',
					wp_kses(
						__( '<span class="nav-short">Next</span>', 'twentytwentyone' ),
						array(
							'span' => array(
								'class' => array(),
							),
						)
					),
					is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' )
				),
			)
		);
	}
}

   
Quote
(@devsam)
Member Admin
Joined: 5 years ago
Posts: 18
Topic starter  

For Next and Previous Post Links

 

echo '<nav class="navigation pagination mob-pagination" role="navigation" aria-label="Posts">
					<h2 class="screen-reader-text">Posts navigation</h2>
					<div class="nav-links">';
					
			
			 previous_post_link('%link', '<svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 13v-2H8l4-4-1-2-7 7 7 7 1-2-4-4z" fill="currentColor"></path></svg> <span class="nav-prev-text"><span class="nav-short">Previous</span></span>');
			 
			 echo '&nbsp; &nbsp; &nbsp; &nbsp;'; 
			 
			 next_post_link('%link', '<span class="nav-next-text"><span class="nav-short">Next</span></span> <svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="m4 13v-2h12l-4-4 1-2 7 7-7 7-1-2 4-4z" fill="currentColor"></path></svg>');  
			
			
			echo '</div>
				</nav>';

   
ReplyQuote
Share:
Reviews & Ratings Get your stoe online with Shopify in 60 minutes Shop Now