php - Put limit on wordpress custom fields -
i trying limit wordpress custom fields fetching through loop , want first 2 results. not familiar php.
here code below using,
<?php $gallery_data = get_post_meta( $post->id, 'gallery_data', true ); if ( isset( $gallery_data['image_url'] ) ) { for( $i = 0; $i < count( $gallery_data['image_url'] ); $i++ ) { ?> <div class="clearfix audio-block"> <span class="play-btn in-spa" play-url="<?php esc_html_e( $gallery_data['image_url'][$i] ); ?>"> <a href=""> <i class="glyphicon glyphicon-play"></i></a> </span> <span class="recite-nam in-spa"> <?php esc_html_e( $gallery_data['text_url'][$i] ); ?> </span> </div> <?php } } ?>
Comments
Post a Comment