Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Combine multiple blogs in Related Posts
Regular Contributor
Nov 2, 2018 5:18 PM
I want to combine 4 blogs into a Multiple related topics listing. This is my attempt to combine them:
<!-- combine blogs --> {% set blog_one_posts = blog_recent_topic_posts('XXXXXX', topic.slug, 4) %} {% set blog_two_posts = blog_recent_topic_posts('XXXXXX', topic.slug, 4) %} {% set blog_three_posts = blog_recent_topic_posts('XXXXXX', topic.slug, 4) %} {% set blog_four_posts = blog_recent_topic_posts('XXXXXX', topic.slug, 4) %} {% set all_posts = (blog_one_posts + blog_two_posts + blog_three_posts + blog_four_posts) %}
This example is using the HS simple related post code:
{% if content.topic_list %} <h3>Related posts</h3> {% for topic in content.topic_list %} {% if loop.first %} {% set related_posts = blog_recent_topic_posts('default', topic.slug, 5 ) %} {% for post in related_posts %} {% unless content.absolute_url == post.absolute_url %} {{ post.name}} {% endunless %} {% endfor %} {% endif %} {% endfor %} {% endif %}
I propose to change:
{% set related_posts = blog_recent_topic_posts(all_posts, topic.slug, 5 ) %}
But it's not working ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content