重复组魔术字段中的重复字段

时间:2014-10-05 18:02:49

标签: php wordpress

我在魔术字段中有一个写入面板,其中有一个可以复制的组,其中包含一个可以复制的图像字段。

到目前为止,我有重复组的代码,但我对如何在其中显示重复字段感到有些困惑。

我正在使用Magic Fields 1.6.2.1

我的重复组代码是

<?php
$gallerys = getGroupOrder('gallery_section_title');
foreach($gallerys as $gallery) {
?>

<?php echo get('gallery_section_title',$gallery);?>

<?php echo get('gallery_section_text',$gallery);?>
<?php echo get('gallery_section_image',$gallery);?>

<?php } ?>

此部分是需要在重复组中重复的部分

<?php echo get('gallery_section_image',$gallery);?>

我做了一些搜索,但找不到任何有用的东西。 有没有人有任何想法如何实现这一点,我很难过。

谢谢

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,下面的代码对我有用,可能有一种更有效的方法,但这样做有效。

<?php $groups = getGroupOrder('gallery_section_title'); 
    foreach($groups as $group) { ?>  

<?php echo get('gallery_section_title', $group); ?>
<?php echo get('gallery_section_text', $group); ?>

<?php $fields = get_field_duplicate('gallery_section_image',$group); 
foreach($fields as $field)
{ ?> 

<?php echo $field[o]; ?>    

<?php } ?>

<?php } ?>