How to transform this code :
<?php
if(have_posts()):
$end = array(3,6,9,12,15,18,21,24,27,30,33,36,39,42,45);
$a = 0;
while (have_posts()) : the_post();
$a++;
global $post;
?>
<li class="item_list<?php if (in_array($a, $end)) { echo " right"; } ?>">
in to a function that would start like this
$display =
Thank YOu so much in advance 🙂
you can’t turn your code into a function because it is part of an if/while/endwhile/endif structure;
to achieve what you want, try alternatively to use the modulus operator: