【发布时间】:2016-07-21 21:01:07
【问题描述】:
我有一个嵌套的转发器字段。
嵌套部分是一个模式窗口,打开时会在第二个转发器字段上展开。但是,当所有内容都填写完毕后,模式窗口会显示循环中第一项的信息。
它应该是这样工作的: http://pagedev.co.uk/hoppings/product-sector.php#
这是我的代码:
<div class="container">
<?php while( have_rows('product_sections') ): the_row(); ?>
<div class="sector-heading">
<img src="<?php the_sub_field('section_logo'); ?>">
<div><?php the_sub_field('section_intro'); ?></div>
</div>
<?php if( have_rows('products') ): ?>
<div class="grid-wrapper">
<?php while( have_rows('products') ): the_row(); ?>
<!--Start Single Product-->
<div class="grid-item">
<div class="image-hovers">
<img src="<?php the_sub_field('thumbnail'); ?>">
<a class="js-open-modal" href="#" data-modal-id="popup"><div class="product-hover"></div></a>
</div>
<div class="grid-title">
<h2><?php the_sub_field('product_name'); ?></h2>
</div>
</div>
<!--Start Single Product Modal-->
<div id="popup" class="modal-box">
<a href="#" class="js-modal-close close">×</a>
<div class="modal-wrap">
<div class="modal-img">
<img src="<?php the_sub_field('thumbnail'); ?>">
</div>
<div class="modal-content">
<h2><?php the_sub_field('product_name'); ?></h2>
<p><strong><?php the_sub_field('product_size'); ?></strong></p>
<hr>
<?php the_sub_field('product_description'); ?>
<a href="<?php the_sub_field('product_description'); ?>"><div class="modal-stockist">Find a Stockist</div></a>
<a href="<?php the_sub_field('literature_link'); ?>"><div class="modal-literature">Literature</div></a>
</div>
</div>
</div>
<!--Close Single Product Modal-->
<?php endwhile; // end of the loop. ?>
</div>
<!--End Grid Wrapper-->
<?php endif; ?>
<!-- Close product repeater field -->
<?php endwhile; // end of the loop. ?>
</div>
<!--End Container-->
任何帮助都会很棒!
李
【问题讨论】:
标签: wordpress advanced-custom-fields