Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 高级自定义字段不显示中继器_Php_Wordpress_Repeater_Advanced Custom Fields - Fatal编程技术网

Php 高级自定义字段不显示中继器

Php 高级自定义字段不显示中继器,php,wordpress,repeater,advanced-custom-fields,Php,Wordpress,Repeater,Advanced Custom Fields,您好,因为自定义插件,我在显示ACF字段时遇到了问题。 然后我发现我可以写: <?php $outputtext= get_field('text'); ?> <?php echo $outputtext; ?> 而不是 <?php get_field('text'); ?> 因为当插件被激活时,这不起作用。 因此,我已经搜索了一段时间的答案,并以同样的方式进行测试,我得到的字段也显示了一个中继器。没有成功 是的,我一直在测试常规代码 &l

您好,因为自定义插件,我在显示ACF字段时遇到了问题。 然后我发现我可以写:

<?php $outputtext= get_field('text'); ?>
<?php echo $outputtext; ?>

而不是

<?php get_field('text'); ?>

因为当插件被激活时,这不起作用。


因此,我已经搜索了一段时间的答案,并以同样的方式进行测试,我得到的字段也显示了一个中继器。没有成功

是的,我一直在测试常规代码

    <?php
    // check if the repeater field has rows of data
    if( have_rows('topp_yrken_referenser') ):
        // loop through the rows of data
        while ( have_rows('topp_yrken_referenser') ) : the_row(); { ?>

            <div class="col-xs-12 col-sm-4">
               <blockquote>
                    <?php // display a sub field value
                    the_sub_field('topp_yrke_referens');
                    ?>
               </blockquote>
            </div>


       <?php } endwhile;
    else :
        // no rows found
    endif;
    ?>

这就是它在定制插件之前的工作方式,并停止工作

  • 我怎么做像这样的工作,就像我用这个来工作一样

  • 这个$this=get_字段('text');有名字吗

  • 
    div class=“col-xs-12 col-sm-4”>
    

    这是代码所能做到的最简单的部分。

    没有else/endif它能工作吗?没有else它几乎是一样的。没有endif我得到一个空站点,没有else和endif我得到一个空页面。。。
    <?php if (have_rows('topp_yrken_referenser')){ ?>
         <?php while (have_rows('topp_yrken_referenser')) { the_row(); ?>
         div class="col-xs-12 col-sm-4">
                   <blockquote>
                        <?php the_sub_field('topp_yrke_referens'); ?>
                   </blockquote>
                </div>
         <?php }; // while:   ?>
        <?php }; ?>