Continuous Loop for “Previous” and “Next” Posts
-
Absolutely love this theme for a portfolio site!
Is it possible to get some input on how you would best change the pagination code so that the most recent post (“/girls-girls-girls”) would show both the “next post” (the second latest post) as well “the previous post” (which would be the earliest post). It currently only shows the “Next Post”
Eskell’s pagination code:
// The pagination links also work as a no-js fallback, so they always need to be output.
$prev_link = get_previous_posts_link( ‘<span class=”arrow stroke-cc”>’ . eksell_get_theme_svg( ‘ui’, ‘arrow-left’, 96, 49 ) . ‘</span><span class=”screen-reader-text”>’ . esc_html__( ‘Previous Page’, ‘eksell’ ) . ‘</span></span>’, $query_args[‘max_num_pages’] );
$next_link = get_next_posts_link( ‘<span class=”screen-reader-text”>’ . esc_html__( ‘Next Page’, ‘eksell’ ) . ‘</span></span><span class=”arrow stroke-cc”>’ . eksell_get_theme_svg( ‘ui’, ‘arrow-right’, 96, 49 ) . ‘</span>’, $query_args[‘max_num_pages’] );if ( $prev_link || $next_link ) :
$pagination_class = ! $prev_link ? ‘ only-next’ : ( ! $next_link ? ‘ only-previous’ : ” );
?><nav class=”link-pagination<?php echo esc_attr( $pagination_class ); ?>”>
<?php if ( $prev_link ) : ?>
<div class=”previous-wrapper”>
<?php echo $prev_link; ?>
</div><!– .previous-wrapper –>
<?php endif; ?><?php if ( $next_link ) : ?>
<div class=”next-wrapper”>
<?php echo $next_link; ?>
</div><!– .next-wrapper –>The page I need help with: [log in to see the link]
- The topic ‘Continuous Loop for “Previous” and “Next” Posts’ is closed to new replies.