使用中的链接iguanarama\'s 回答,您的更新代码是:
<?php if (has_term( \'type-1\', \'projecttype\' ) ) { ?>
<div class="holder">
<?php if ( have_posts() ) : ?>
<div class="container-fluid">
<div class="project-paginat">
<?php if(get_post_meta($post->ID, "_type", true)){ ?>
<ul class="list-inline">
<li><a href="<?php echo get_home_url(); ?>/our-work">Back to Our Work</a></li>
<li>>> <?php echo get_post_meta($post->ID, "_type", true); ?></li>
<li>
<?php
if( get_adjacent_post(false, \'\', true) ) {
previous_post_link(\'%link\', \'< Previous Project\', true, \'\', \'projectcategory\');
} else {
$args = array(
\'posts_per_page\' => 1,
\'order\' => \'DESC\',
\'category_name\' => \'projectcategory\',
);
$first = new WP_Query( $args ); $first->the_post();
echo \'<a href="\' . get_permalink() . \'">< Previous Project</a>\';
wp_reset_query();
};
?>
</li>
<li>
<?php
if( get_adjacent_post(false, \'\', false) ) {
next_post_link(\'%link\', \'Next Project >\', true, \'\', \'projectcategory\');
} else {
$args = array(
\'posts_per_page\' => 1,
\'order\' => \'ASC\',
\'category_name\' => \'projectcategory\',
);
$last = new WP_Query( $args ); $last->the_post();
echo \'<a href="\' . get_permalink() . \'">Next Project ></a>\';
wp_reset_query();
};
?>
</li>
</ul>
<?php } else {
echo \'<p>There Is No Project Type To Display.</p>\';
} ?>
</div>
Reference: http://wplancer.com/infinite-next-and-previous-post-looping-in-wordpress/