{"id":4811867,"date":"2014-04-16T00:05:31","date_gmt":"2014-04-16T00:05:31","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/posting-specific-posts-within-main-loop\/"},"modified":"2016-08-21T19:22:41","modified_gmt":"2016-08-21T19:22:41","slug":"posting-specific-posts-within-main-loop","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/posting-specific-posts-within-main-loop\/","title":{"rendered":"Posting Specific Posts within main loop"},"content":{"rendered":"<p>I&#8217;m slowly learning php and lost at this point. I&#8217;m setting up a site where we have sponsors that we would like to promote. We are using a masonry theme so the idea is to incorporate a sponsor logo every nth post. The logos are currently posted as a status format but unless I change the date every time, they won&#8217;t remain in the same positions. I&#8217;d like them to automatically show up every nth post. <\/p>\n<p>I figured this could be done a few ways. Assigning a category &#8220;Sponsor&#8221; and pulling from that, pulling form the status post format or creating an array of all the sponsors. <\/p>\n<p>This is the basic loop used and currently what I&#8217;ve been trying. <\/p>\n<pre><code>\/\/ Begin loop\n            while ( have_posts() ) : the_post();\n            $count++;\n            get_template_part( &#039;content&#039;, get_post_format() );\n            if ( $count%3==0 ) {\n\t\techo &#039;first element in array &#039;;\n            }\n            endwhile; ?&gt;<\/code><\/pre>\n<p>I&#8217;d like to be able to use the status post format that way others can easily change logos\/links\/etc without too much difficulty. Is it possible to create a loop that would do this? Post 3 normal posts, then 1 status\/&#8221;sponsor&#8221; post, then 3 more posts, then the next sponsor post, etc? <\/p>\n<p>Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-4811867","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4811867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4811867\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4811867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}