Jump to content

WP Advanced Custom Fields repeater pagination help


jacobsafari

Recommended Posts

Hey guys, I'm fairly new to PHP and do a lot of work in Wordpress. I installed the ACF plugin and have customized my loop within the correct parameters. I am wondering if there's a way to paginate after a certain number of entries. I tried paginating using custom loops for the have_posts area but that didnt seem to do the trick and also removed the Repeater loop for the page. I also tried looking for support on the ACF forum itself and its something that hasn't  been solved. I feel like this might be an easy thing to do but I'm new to this and don't really understand what loop to put it in(?). I would like to paginate after 4 entries. Thanks so much for you input in advance!

 

Here is the code I'm using on a custom page template for wp

 

<?php if(have_posts() ) : while (have_posts()) : the_post(); ?>
    
<!--- START LOOP --->	
         
<?php $columns = get_field( 'events' ); ?>
<?php if($columns): ?>
	<?php foreach( $columns as $column ): ?>
		<div id="event">
		<?php if($column['events_items']): ?>

		<?php foreach($column['events_items'] as $item ): ?>


<div id="presents"><?php echo $item['presented_by']; ?></div>
		<div id="date"><?php echo $item['date']; ?></div>
<div id="location">AT <?php echo $item['venue']; ?></div>
<div id="city"><?php echo $item['city_state']; ?></div>
<div id="flier"><a class="inline" href="#<?php echo $item['id']; ?>"><img src="<?php echo $item['flyer']; ?>" alt="" border="0" /></a></div>
<div id="headliner"><?php echo $item['headliner']; ?></div>
<div id="artist2"><?php echo $item['support1']; ?> - <?php echo $item['support2']; ?><br>
& <?php echo $item['support3']; ?></div>



<div style="display:none"><div id="<?php echo $item['id']; ?>" class="event_popup"><div id="event_detail">
<div id="event_left">
<div id="event_headliner">
<div id="event_headlinername"> <?php echo $item['headliner']; ?></div>
<div id="event_headlinerpic"><a href="<?php echo $item['headliner_url']; ?>" target="_blank"><img src="<?php echo $item['headliner_image']; ?>" alt="" border=0/></a></div>
</div>
<div id="event_videobio">
<div id="event_video"><iframe src="http://www.youtube.com/embed/<?php echo $item['video_url']; ?>?rel=0" frameborder="0" width="250" height="200"></iframe></div>
<div id="event_bio"><?php echo $item['headliner_bio']; ?></div>
</div>
</div>
<div id="event_right">

<div id="event_support">
<div id="event_supportname"> <?php echo $item['support1']; ?></div>
<div id="event_supportpic"><a href="<?php echo $item['support1_url']; ?>" target="_blank"><img src="<?php echo $item['support1_image']; ?>" alt="" border=0/></a></div>
</div>

<div id="event_support">
<div id="event_supportname"> <?php echo $item['support2']; ?></div>
<div id="event_supportpic"><a href="<?php echo $item['support2_url']; ?>" target="_blank"><img src="<?php echo $item['support2_image']; ?>" alt="" border=0/></a></div>
</div>

<div id="event_support">
<div id="event_supportname"> <?php echo $item['support3']; ?></div>
<div id="event_supportpic"><a href="<?php echo $item['support3_url']; ?>" target="_blank"><img src="<?php echo $item['support3_image']; ?>" alt="" border=0/></a></div>
</div></div></div>

<div id="event_bottom">sdoifjsoafjdaiosfjdasoifj oosdafja</div>


		</div>
	</div>


		<?php endforeach; ?>
		<?php endif; ?>
		</div>
	<?php endforeach; ?>
<?php endif; ?>


<!--- END LOOP --->


<?php endwhile; endif;  ?>

 

attached is a picture of what it looks like in a  loop (the boxes for events).

post-133410-13482403439762_thumb.png

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.