Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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
Wordpress 如何在高级自定义字段中列出带有标签和值的中继器子字段?_Wordpress_Advanced Custom Fields - Fatal编程技术网

Wordpress 如何在高级自定义字段中列出带有标签和值的中继器子字段?

Wordpress 如何在高级自定义字段中列出带有标签和值的中继器子字段?,wordpress,advanced-custom-fields,Wordpress,Advanced Custom Fields,我已经搜索过了,但找不到任何解决方案来列出带有子字段标签及其值的repeater字段行 在我的例子中,我想列出一个带有标签和值的repeater字段子字段。 例如: '子字段标签'='值' 有没有办法做到这一点 如果您知道要从中检索的标签,只需使用标准方法: if( have_rows('repeater_field_name') ): while ( have_rows('repeater_field_name') ) : the_row(); echo 'Label

我已经搜索过了,但找不到任何解决方案来列出带有子字段标签及其值的repeater字段行

在我的例子中,我想列出一个带有标签和值的repeater字段子字段。 例如:

'子字段标签'='值'


有没有办法做到这一点

如果您知道要从中检索的标签,只需使用标准方法:

if( have_rows('repeater_field_name') ):
    while ( have_rows('repeater_field_name') ) : the_row();
        echo 'Label = ' . get_sub_field('sub_field_name') . '<br>';
    endwhile;
endif;
无论如何,我建议你去看看。它完整、清晰,包含大量涵盖最常见用途的代码片段。


 <?php $args = array('post_type' => 'post');
            $the_query = new WP_Query( $args );
            query_posts( $args );
            while ( have_posts() ) : the_post();
   $field = get_field_object('field_name'); 
   echo $field['label']; //print label name
   echo the_field('field_name'); //and its value
    endwhile; wp_reset_query(); ?>

请尝试此希望帮助您

检查并@RichardMiles它不是高级自定义字段插件。。。对高级自定义字段插件有什么建议吗?欢迎!若你们接受这个答案,那个么勾选上面的箭头。帮助别人
 <?php $args = array('post_type' => 'post');
            $the_query = new WP_Query( $args );
            query_posts( $args );
            while ( have_posts() ) : the_post();
   $field = get_field_object('field_name'); 
   echo $field['label']; //print label name
   echo the_field('field_name'); //and its value
    endwhile; wp_reset_query(); ?>