How to Show Adjacent Posts

TODO:

When shown a single post, you may want to show link to other articles at the end of the post. This is a very common practice to improve user experience, so visitors can continue reading other articles without having to go back to the main blog page, or to other archive pages. If a user cam directly to a post, show the adjacent post is a good option to show visitors other articles that might be interesting as well.

 

<!--adjacent posts-->
{{post show="next" assign_to="next"}} 
{{post show="previous" assign_to="previous"}}
<section class="row">
    <div class="next col-md-6">
        {{if $next.data.post_permalink}}
        <a class="" rel="next" href="{{$next.data.post_permalink}}">
            <div>Next Article<br/>
            {{if $next.data.post_thumbnail}}
            <img src="{{$next.data.post_thumbnail}}" width="80">
            {{else}}
             <img src="http://placehold.it/80x80" width="80">
            {{/if}}
            </div> {{$next.data.post_title}}
        </a>
        {{/if}}
    </div>
    
    <div class="prev text-right col-md-6">
        {{if $previous.data.post_permalink}}
        <a class="" rel="prev" href="{{$previous.data.post_permalink}}">
            <div>Previous Article<br/>
            {{if $previous.data.post_thumbnail}}
            <img src="{{$previous.data.post_thumbnail}}" width="80">
            {{else}}
             <img src="http://placehold.it/80x80" width="80">
            {{/if}}
            </div> {{$previous.data.post_title}}</a>
        {{/if}}
    </div>
</section><!--/adjacent posts-->

 

Post Available Data

TODO:

 

array (size=27)
  'ID' => int 2
  'post_author' => string '1' (length=1)
  'post_date' => string '2015-10-03 18:46:17' (length=19)
  'post_date_gmt' => string '2015-10-03 18:46:17' (length=19)
  'post_content' => string '<p>This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:</p>
<blockquote><p>Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)</p>
<'... (length=1027)
  'post_title' => string 'My Home Page' (length=12)
  'post_excerpt' => string 'This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)
…or something like th'... (length=874)
  'post_status' => string 'publish' (length=7)
  'comment_status' => string 'open' (length=4)
  'ping_status' => string 'closed' (length=6)
  'post_password' => string '' (length=0)
  'post_name' => string 'front-page' (length=10)
  'to_ping' => string '' (length=0)
  'pinged' => string '' (length=0)
  'post_modified' => string '2016-02-24 17:25:40' (length=19)
  'post_modified_gmt' => string '2016-02-24 17:25:40' (length=19)
  'post_content_filtered' => string '<p>This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:</p>
<blockquote><p>Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)</p>
<'... (length=1027)
  'post_parent' => int 0
  'guid' => string 'http://bldr-appcropolis.localhost:8888/?page_id=2' (length=49)
  'menu_order' => int 0
  'post_type' => string 'page' (length=4)
  'post_mime_type' => string '' (length=0)
  'comment_count' => string '0' (length=1)
  'filter' => string 'raw' (length=3)
  'post_thumbnail' => string 'http://basic-blog-developer.simplifysites.com/sites/basic-blog-developer.simplifysites.com/wp/wp-content/uploads/2015/10/10-credits.png' (length=135)
  'post_permalink' => string 'http://basic-blog-developer.simplifysites.com/' (length=46)
  'post_content_raw' => string '<p>This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:</p>
<blockquote><p>Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)</p></'... (length=1025)