I need this type of structure in PHP foreach loop. and i tried this code :
<ul>
<li>1</li>
</ul>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
i tried this condition inside loop and working fine but i need 1 li on first ul.
<?php
$counter = 1;
foreach( $myposts as $post ) :
setup_postdata($post);
if ($counter % 5 == 1) {
echo '<ul>';
}
echo '<li>testing ...</li>'
if($counter % 5 == 0) {
echo '</ul>';
}
$counter++;
endforeach;
?>
any one extend my logic ??