<?php
$i = 1;
$y = 5;
?>
<?php while (have_posts()) : the_post(); ?>
<?php
if (fmod($i, $y) == 0) {
echo '<tr>';
}
?>
What i'm doing wrong? I want every 5 time to show the <tr>
,any help?
<?php
$i = 1;
$y = 5;
?>
<?php while (have_posts()) : the_post(); ?>
<?php
if (fmod($i, $y) == 0) {
echo '<tr>';
}
?>
What i'm doing wrong? I want every 5 time to show the <tr>
,any help?
I don't see where you increment $i; nor why you are using fmod
instead of %
(fmod
is only for floating-point moduli). Try this code:
<?php
$i = 1;
$y = 5;
while (have_posts())
{
the_post();
if ($i % $y == 0) echo '<tr>';
$i++;
}
?>