Question

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

Was it helpful?

Solution

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.

Specific Post With Themes

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.

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}

Reference

Post Theme Operators: http://www.tumblr.com/docs/en/custom_themes#posts

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top