簡體   English   中英

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

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

我有一個中繼器,下面將顯示它不返回任何錯誤以及不返回任何錯誤。 (回聲不起作用)

我正在嘗試顯示子字段officetype,但這是設置:

Offices(中繼器)-> Officetypeinfo(repeater)->多個子字段(例如officetype)

誰能告訴我我做錯了什么,請告訴我您是否需要我提供的更多信息。

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

提前致謝!

無需添加the_sub_field('officetype'); echo $show;

您是否檢查過使用的字段名正確? 嘗試var_dump('field-name'); 檢查哪里出錯了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM