简体   繁体   English

我的嵌套中继器未返回任何内容(Wordpress插件ACF)

[英]My nested repeater isn't returning anything(Wordpress plugin ACF)

I have a repeater which I will show below which isn't returning any errors as well as it's not returning anything. 我有一个中继器,下面将显示它不返回任何错误以及不返回任何错误。 (Echo not working) (回声不起作用)

I'm trying to show the sub field officetype but this is the setup: 我正在尝试显示子字段officetype,但这是设置:

Offices(repeater)->Officetypeinfo(repeater)->Multiple sub fields(Eg officetype) Offices(中继器)-> Officetypeinfo(repeater)->多个子字段(例如officetype)

Can anyone tell me what I did wrong, please do tell me if you need more then what I provided. 谁能告诉我我做错了什么,请告诉我您是否需要我提供的更多信息。

<?php if( get_field('offices')): ?>
    <?php while( has_sub_field('offices')): ?>
        <?php if( get_sub_field('officetypeinfo')): ?>
            <?php while( has_sub_field('officetypeinfo')): ?>
                <?php
                    $show = the_sub_field('officetype');
                       echo $show;
                       the_sub_field('officetype');
                ?>
            <?php endwhile; ?>
        <?php endif; ?>
    <?php endwhile; ?>
<?php endif; ?>

Thanks in advance! 提前致谢!

There is no need to add the_sub_field('officetype'); 无需添加the_sub_field('officetype'); after echo $show; echo $show;

Did you check that you're using the right field-names? 您是否检查过使用的字段名正确? Try var_dump('field-name'); 尝试var_dump('field-name'); to check where it goes wrong. 检查哪里出错了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM