我对 PHP 相当陌生,并且在 Wordpress 中做了很多工作。我安装了 ACF 插件并在正确的参数内自定义了我的循环。我想知道是否有办法在一定数量的条目后进行分页。我尝试对 have_posts 区域使用自定义循环进行分页,但这似乎没有奏效,并且还删除了页面的 Repeater 循环。我还尝试在 ACF 论坛本身及其尚未解决的问题上寻求支持。我觉得这可能是一件容易的事情,但我是新手,并不真正了解将它放入哪个循环(?)。我想在 4 个条目后分页。非常感谢您提前输入!
这是我在 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; ?>