title: Infinite next/prev post loop
body: <p>Using the code below, I'm trying to set an infinite next/prev post loop solely for pages (as opposed to posts). The last page I have, the previous button links to a page, but the next button links to the first post I have available. How can I change it to only target pages?</p>
  
  <pre><code>&lt;div class="port-nav left"&gt;
          &lt;?php 
              /**
               *  Infinite next and previous post looping in WordPress
               */
              if( get_adjacent_post(false, '', true) ) { 
          ?&gt;
                  &lt;p class="prev"&gt;&lt;?php previous_post_link('%link'); ?&gt;&lt;/p&gt;
          &lt;?php
              } else { 
                  $first = new WP_Query('posts_per_page=1&amp;order=DESC'); $first-&gt;the_post();
                      echo '&lt;a href="' . get_permalink() . '"&gt;&amp;larr; Previous Post&lt;/a&gt;';
                  wp_reset_query();
              };
          ?&gt;
          &lt;?php       
              if( get_adjacent_post(false, '', false) ) { 
          ?&gt;
                  &lt;p class="next"&gt;&lt;?php next_post_link('%link'); ?&gt;
          &lt;?php
              } else { 
                  $last = new WP_Query('posts_per_page=1&amp;order=ASC'); $last-&gt;the_post();
                      echo '&lt;a href="' . get_permalink() . '"&gt;Next Post &amp;rarr;&lt;/a&gt;';
                  wp_reset_query();
              }; 
          ?&gt;
      &lt;/div&gt;
  </code></pre>