【发布时间】:2017-05-23 05:47:39
【问题描述】:
我在十月 CMS 中使用 Rain Lab Post。 我使用 blogPost 组件并从单个类别中获取帖子没有问题。例如。这是显示某个类别的最后 5 个帖子的部分内容
[blogPosts]
pageNumber = "{{ :page }}"
categoryFilter = "{{ slug }}"
postsPerPage = 5
noPostsMessage = "No news in this category"
sortOrder = "published_at desc"
categoryPage = 404
postPage = "singlePost"
==
<li> <a href="#">{{category.name}}</a>
<ul class="drop-down full-width col-5 hover-expand">
<li class="validation">
<h2 class="mm-title">{{category.name}}</h2>
</li>
{% for post in posts %}
<li>
{% for image in post.featured_images|slice(0,1) %}
<a href="{{ post.url }}"><img src="{{ image.path }}" alt=""></a>
{% endfor %}
<h3><a href="{{ post.url }}">{{post.title}}</a></h3>
</li>
{% endfor %}
</ul>
</li>
但是现在,我正在主页上工作,并希望显示所有类别的最后一篇文章。每个类别 1 个,5 个类别,合并。
有人知道怎么做吗?
提前致谢
【问题讨论】:
标签: laravel octobercms octobercms-plugins