在Tumblr上每3个帖子添加内容 [英] add content every 3 posts on Tumblr
问题描述
我想知道是否有一种方法可以在每个页面的第3个帖子之后放置内容,以便可以呈现一些内容...我在tumblr主题API上找不到任何内容
I would like to know if there is a way to put content after 3rd post on every page so I can render something... I don't find anything on tumblr theme API
推荐答案
带有API的特定帖子
如果您使用的是API来收集/附加帖子,则需要您自己做.一个简单的循环/计数就足以确定第三个帖子.
Specific Post With API
If you are using the API to gather / append posts this would be left for you to do. A simple loop / count should be enough to determine the third post.
如果您正在创建Tumblr主题,则可以使用主题运算符/阻止来满足以下要求:
If you are creating a Tumblr theme, there is a theme operator / block to cater for this:
{block:Post[1-15]}
/* Add something to the post [1-15] on each page */
{/block:Post[1-15]}
以指定的偏移量为帖子呈现.这样便可以在帖子的中间插入广告或设计元素.
Rendered for the post at the specified offset. This makes it possible to insert an advertisement or design element in the middle of your posts.
问题特定答案
OP在第3个帖子之后声明 ,为此,请在{block:Posts}{/block:Posts}
循环的最末尾包含该块.
Question Specific Answer
OP states after the 3rd post, to do this include the block at the very end of the {block:Posts}{/block:Posts}
loop.
{block:Posts}
/* All your layout / post logic here, making sure
there is nothing left to render */
{block:Post3}
/* Add something directly after the third post on each page */
{/block:Post3}
{/block:Posts}
参考
帖子主题运算符: http://www.tumblr.com/docs/zh-CN custom_themes#posts
这篇关于在Tumblr上每3个帖子添加内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!