GrayofD4
9/21/2017 - 5:45 PM

Looping Custom Post type pagination

Looping Custom Post type pagination

<?php
echo $next_start;
	$prev_post = get_adjacent_post( false, '', true );

	#print_r($prev_post);
	if ( is_a( $prev_post, 'WP_Post' ) ) {
		previous_post_link( '%link', __('Previous' , 'skivvy') );
	} else { 
		$first = new WP_Query('posts_per_page=1&order=DESC&post_type=saints');
			$first->the_post();
			echo '<a href="' . get_permalink() . '">Previous Post</a>';
		wp_reset_query();
	} 

echo $next_end;

echo $prev_start;
	$next_post = get_adjacent_post( false, '', false );
	#print_r($next_post);
	if ( is_a( $next_post, 'WP_Post' ) ) { 
		next_post_link('%link', 'Next'); 
	} else { 
		$last = new WP_Query('posts_per_page=1&order=ASC&post_type=saints');
			$last->the_post();
			echo '<a href="' . get_permalink() . '">Next Post</a>';
		wp_reset_query();
	}
echo $prev_end;