How to increase numbers if exist
-
Is there a more efficient way to increase these numbers? I’ve looked into $i++ but couldn’t make it work.
<?php $args = array( 'post_type' => 'album' ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); $track1 = get_field('track1'); if($track1 !== '') { echo '<br><strong>1 <strong>'; the_field('track1'); } $track2 = get_field('track2'); if($track2 !== '') { echo '<br><strong>2 </strong>'; the_field('track2'); } $track3 = get_field('track3'); if($track3 !== '') { echo '<br><strong>3 </strong>'; the_field('track3'); } endwhile; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to increase numbers if exist’ is closed to new replies.