Next and Previous loop


I am making a wordpress site but i need little help,

What I have is a function with Next and Previous buttons to list projects, but
when i go to the last project the Next button is gone.

What I want to do is, when I go to the last project I hit “Next” and direct me to the first project something like loop slide

Here is my code:

<?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>>> &nbsp;<?php echo get_post_meta($post->ID, "_type", true); ?></li>
                <li><?php previous_post_link('%link', '&lt; Previous Project', true, '', 'projectcategory') ?></li> 
                <li><?php next_post_link('%link', 'Next Project &gt;', true, '', 'projectcategory') ?></li>     
            <?php } else {
                echo '<p>There Is No Project Type To Display.</p>';
            } ?>
DroDro 8 months 2020-12-10T12:10:21-05:00 0 Answers 6 views 0

Leave an answer