Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Filter blog content module according to blog tags/topics on listing template
SOLVERegular Contributor
06-03-2019 10:22
Hi!
I would like to ask how can I able to filter the recent posts to this blog content template , currently this code will make all of the recent posts appear. We want to modify it by arranging it according to categry for example this type of topic.
Whiskey Content
Feature three articles
Tequila Content
Feature three articles
I have this type of filter set-up in one of ourr homepage, and tried to insert in below the blog-section div, but it seems won't work.
{% set topic_posts = blog_recent_topic_posts(4488098559, 'whiskey-content', 3) %}
<div class="blog-section"> <div class="blog-listing-wrapper cell-wrapper"> {# simple_list_page indicates the "blog/all" page, which is a list of links to every blog post #} <div class="post-listing{% if simple_list_page %}-simple{% endif %}"> {% if blog_author %} <div class="hs-author-profile"> <h2 class="hs-author-name">{{ blog_author.display_name }}</h2> {% if blog_author.avatar %} <div class="hs-author-avatar"> <img src="{{ blog_author.avatar }}"> </div> {% endif %} <div class="hs-author-bio">{{ blog_author.bio }}</div> {% if blog_author.has_social_profiles %} <div class="hs-author-social-section"> <span class="hs-author-social-label">Find me on:</span> <div class="hs-author-social-links"> {% if blog_author.facebook %} <a href="{{ blog_author.facebook }}" target="_blank" class="hs-author-social-link hs-social-facebook"> </a> {% endif %} {% if blog_author.linkedin %} <a href="{{ blog_author.linkedin }}" target="_blank" class="hs-author-social-link hs-social-linkedin"> </a> {% endif %} {% if blog_author.twitter %} <a href="{{ blog_author.twitter }}" target="_blank" class="hs-author-social-link hs-social-twitter"> </a> {% endif %} {% if blog_author.google_plus %} <a href="{{ blog_author.google_plus }}?rel=author" target="_blank" class="hs-author-social-link hs-social-google-plus"> </a> {% endif %} </div> </div> {% endif %} </div> <h3 class="hs-author-listing-header">Recent Posts</h3> {% endif %} {% for content in contents %} <div class="post-item"> {% if not simple_list_page %} <a href="{{content.absolute_url}}"> <div class="post-body clearfix"> {% if content.post_list_summary_featured_image %} <div class="hs-featured-image-wrapper"> <img src="{{ content.post_list_summary_featured_image }}" class="hs-featured-image" alt="{{ content.name }}"> </div> {% endif %} <div class="custom-date"> {{ content.publish_date_local_time.strftime('%d') }} {{ content.publish_date_local_time.strftime('%B') }} </div> <div class="post-header"> <h2>{{ content.name }}</h2> </div> <!--post summary--> </div> </a> {% else %} <h2 class="post-listing-simple"><a href="{{content.absolute_url}}">{{ content.name }}</a></h2> {% endif %} </div> {% endfor %} </div> {% if not simple_list_page %} <!-- Numbered Pagination --> <div class="blog-pagination"> {% set page_list = [-2, -1, 0, 1, 2] %} {% if contents.total_page_count - current_page_num == 1 %}{% set offset = -1 %} {% elif contents.total_page_count - current_page_num == 0 %}{% set offset = -2 %} {% elif current_page_num == 2 %}{% set offset = 1 %} {% elif current_page_num == 1 %}{% set offset = 2 %} {% else %}{% set offset = 0 %}{% endif %} <div class="blog-pagination-left"> {% if contents.total_page_count > 5 %} {% if current_page_num >= 4 %} <a href="{{ blog_page_link(1) }}">1</a> <a class="elipses" href="{% if current_page_num <= 5 %}{{ blog_page_link(1) }}{% else %}{{ blog_page_link(current_page_num - 5) }}{% endif %}">...</a> {% endif %} {% endif %} </div> <div class="blog-pagination-center"> {% for page in page_list %} {% set this_page = current_page_num + page + offset %} {% if this_page > 0 and this_page <= contents.total_page_count %} <a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page) }}">{{ this_page }}</a> {% endif %} {% endfor %} </div> <div class="blog-pagination-right"> {% if contents.total_page_count > 5 %} {% if contents.total_page_count - current_page_num > 2 %} <a class="elipses" href="{% if contents.total_page_count - current_page_num <= 5 %}{{ contents.total_page_count }}{% else %}{{ blog_page_link(current_page_num + 5) }}{% endif %}">...</a> <a href="{{ blog_page_link(contents.total_page_count) }}">{{ contents.total_page_count }}</a> {% endif %} {% endif %} </div> <div class="pager"> {% if last_page_num %}<a class="prev-link" href="{{ blog_page_link(last_page_num) }}">« Previous</a>{% endif %} {% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}">Next »</a>{% endif %} </div> </div> {% endif %} </div> </div>
Solved! Go to Solution.
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content