How to show posts of certain label or category in a row in my blogger home page?

给你一囗甜甜゛ 提交于 2021-01-29 05:53:46

问题


I want to first include latest posts in my blog home page and then I want to create a row containing posts of a certain label. I want to display different rows of different labels.

That's how I want to design my blog. But I don't know how to code blogger so that posts of certain labels are shown in that row.

How do I call them or display them in that row?


回答1:


I think It's possible! Just need little bit hard work.

First add CSS.

Then search for

<b:include data='post' name='post' />

Now replace this code with this one -

<b:if cond='data:blog.url == data:blog.homepageUrl'> <b:loop values='data:post.labels' var='label'><b:if cond='data:label.isLast == &quot;true&quot;'>
 <b:if cond='data:label.name != &quot;Your First Label Name&quot;'><div class='row'><b:include data='post' name='post' /></div></b:if>
 <b:if cond='data:label.name != &quot;Your Second Label Name&quot;'><div class='row'><b:include data='post' name='post' /></div></b:if>
 <b:if cond='data:label.name != &quot;Your Third Label Name&quot;'><div class='row'> <b:include data='post' name='post' /></div></b:if>
  </b:if></b:loop><b:else/><b:include data='post' name='post' /></b:if>

Note: you should remember that every post should have one label. And don't forget to add class='column' in article.

I don't try it. Check it by yourself and give me feedback.



来源:https://stackoverflow.com/questions/53910696/how-to-show-posts-of-certain-label-or-category-in-a-row-in-my-blogger-home-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!