How can I make this PHP lines shorter?

前端 未结 4 1490
攒了一身酷
攒了一身酷 2021-01-25 12:45

I have this loop at the same it will count the output:

while ($wp_query->have_posts()) : $wp_query->the_post(); $current++; $current2++;

4条回答
  •  庸人自扰
    2021-01-25 13:06

    So you could use mod - best to use the full tag for WordPress if that is what it is.

    php test if number is odd or even

        // set up the html clips
        if($current % 2 == 0){
        $html_clips = 'first'; 
        }else{
        $html_clips = 'second'; 
        }
        if($current == 0) $html_clips = 'first';
        

提交回复
热议问题