【发布时间】:2019-03-09 23:29:51
【问题描述】:
我尝试植入这个
- Page A0 (images + texts)
-- Page A1
-- Page A1
---Page A2
在页面 A1 和 A2 中,我需要从一组字段中检索画廊和文本。 如果我使用普通字段,而不是在组中,我会实现这一点......但我需要留在组字段中。
<?php
$post_ID = get_the_ID();
$parentpost_id = wp_get_post_parent_id( $post_ID );
$images_images = get_sub_field( "images", $parentpost_id ); //use parents-post field: "broschuren-download"
?>
<div class="hero__image-wrapper <?php if (count ($images_images) > 1) { echo "heroslide" ;} ?> ">
<?php if ( $images_images ) : ?>
<?php foreach ( $images_images as $images_image ): ?>
<img class="hero__image fit-cover" src="<?php echo $images_image['sizes']['large']; ?>" alt="<?php echo $images_image['alt']; ?>" />
<?php endforeach; ?>
<?php endif; ?>
</div>
【问题讨论】:
标签: wordpress field repeater parent advanced-custom-fields