Jump to content

Previous/Next links between specific pages (not all in list)


a-ok
 Share

Recommended Posts

Hi folks,

I'm wondering if it is possible to create Previous/Next links between pages that only have a certain checkbox ticked? I have a Projects > each project structure setup, and if the user checks for a project to be a case study, it generates some new/different fields in the backend. What I'm after is to be able to have Previous/Next links per project that only cycles through the case studies... not all the projects.

Here below is my code that works for ALL projects but not just CASE STUDY projects.

Thanks for your time,

R

<?php /* $page->project_casestudy_check === 1 */ ?>
<div class="project-casestudy-pagination-container clearfix">
  <div class="container-fluid">
   <div class="row">
    <div class="col-xs-12 col-sm-12">
     <?php if ($page->prev->id) : ?>
     <div class="prev-project-container">
      <a class="prev-project" href="<?php echo $page->prev->url; ?>"><span>Previous Project</span></a>
     </div>
     <?php else : ?>
     <div class="prev-project-container">
      <a class="prev-project" href="<?php echo $page->siblings->last->url; ?>"><span>Previous Project</span></a>
     </div>
     <?php endif; ?>
     <?php if ($page->next->id) : ?>
     <div class="next-project-container">
      <a class="next-project" href="<?php echo $page->next->url; ?>"><span>Next Project</span></a>
     </div>
     <?php else : ?>
     <div class="next-project-container">
      <a class="next-project" href="<?php echo $page->siblings->first->url; ?>"><span>Next Project</span></a>
     </div>
     <?php endif; ?>
    </div>
   </div>
  </div>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...