我是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; ?>