I'm using a customized wordpress loop which allows me to style the post a certain way after a certain amount of post. For example, The first three post will be styled the same, the next 4 post will styled differently from the first three and so forth. It also allows me to add <div>
sections between the post.
Here is the code php code I am using to accomplish this.
if (have_posts()) :
$count = 0; $paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;
while (have_posts()) : the_post();
$count++;
if ($count <= 3 && $paged === 1) :
if ($count === 1) echo '<div class="break"><h2>Break div | first 3 posts</h2></div>'; ?>
<div class="first-three">
<?php the_title() ?>
</div>
<?php elseif (3 < $count && $count <= 7 && $paged === 1) :
if ($count === 4) echo '<div class="break"><h2>Break div | next 4 posts</h2></div>'; ?>
<div class="next-four">
<?php the_title() ?>
</div>
<?php elseif (7 < $count && $count <= 13 && $paged === 1) :
if ($count === 8) echo '<div class="break"><h2>Break div | next 6 posts</h2></div>'; ?>
<div class="next-six">
<?php the_title() ?>
</div>
<?php elseif (13 < $count && $count <= 20 && $paged === 1) :
if ($count === 14) echo '<div class="break"><h2>Break div | next other 6 posts</h2></div>'; ?>
<div class="next-other-six">
<?php the_title() ?>
</div>
<?php else :
if ($count === 21) echo '<div class="break"><h2>Break div | last 6 posts</h2></div>'; ?>
<div class="last-six">
<?php the_title() ?>
</div>
<?php endif;
endwhile; ?>
<div class="nav-previous alignleft"><?php next_posts_link('Older posts'); ?></div>
<div class="nav-next alignright"><?php previous_posts_link('Newer posts'); ?></div><?php
endif;
I'm not sure if you needed all of that, but I decided to place it there just in case.
Now here is the part I am having complications with.
<?php elseif (3 < $count && $count <= 7 && $paged === 1) :
if ($count === 4) echo '<div style="clear:both;"></div> <div class="large-6 columns" style="max-width:566px; float:left;"> ', include 'thumbnail-break.php', '</div> '; ?>
For this part I added the include
function to place a template path between the post. It returns the path but it also outputs the number 1 after the content.
How do I get rid of the number 1.
thumbnail-break.php
for someone to be able to answer thisthumbnail-break.php
,
for semicolons;
around include