hello how can i add a pagination to a foreach? i want to display 30 images and then it should continue from 31 at the page 2.

Thank for your help =)

my code:

<?php $images = get_post_meta($post->ID, 'vdw_gallery_id', true);
	foreach ($images as $image) { ?>	
		
		<div class="cf-item gallery-item fw-col-xs-12 fw-col-sm-4 fw-col-md-3">
					<a href="<?php echo wp_get_attachment_url($image); ?>" data-size="1678x900" title="Project name">
						<div class="a-img">
							<?php echo wp_get_attachment_image($image , array(1687,900)); ?>
						</div>
						
					</a>
				</div>
		<?php }
?>

Read more here: foreach pagination image output


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: