How to Get A List Of Related Posts

TODO:

 

<ul class="appc-dynamic" id="appc-related">      
{{related post_id="{{$post.ID}}" assign_to="rel_posts"}}
{{foreach $rel_posts.data as $item}}
    <li>
        <div class="popular-post-img">
            <a href="{{$item.post_permalink}}"> <img src="{{$item.post_thumbnail}}" alt="{{$item.post_title}}"></a>
        </div>
        <div class="popular-post-content">
            {{post show="categories" assign_to="item_categories" post_id="{{$item.ID}}"}}
            <div class="post-category">
                
                {{if $item_categories.data[0]}} 
                <a href="{{$item_categories.data[0].cat_permalink}}" class="cat-item-{{$item_categories.data[0].cat_ID}}" rel="category tag" title="{{$cat.name}}">{{$item_categories.data[0].name}}</a>
                {{/if}}
            </div>
            <h4><a href="{{$item.post_permalink}}" rel="category tag">{{$item.post_title}}</a></h4>
            <span>{{date when="{{$post.post_date}}" format="F j, Y"}}</span>
        </div>
    </li>
{{foreachelse}}
 	<p>No related posts.</p>
{{/foreach}}
</ul>

 

Leave a Reply

Your email address will not be published. Required fields are marked *