Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

madsrh123 on "How to increase numbers if exist"

$
0
0

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 all articles
Browse latest Browse all 8245

Trending Articles