【发布时间】:2018-10-02 04:21:37
【问题描述】:
我正在显示一些表格,而我的表格字段位于转发器字段中,因为我想显示 4 个表格,它们是彼此的一部分。
我正在查看代码,发现它返回了一个 4 的数组。
我看过这段代码:https://wordpress.org/plugins/advanced-custom-fields-table-field/#screenshots 但这似乎只有在表格位于普通字段而不是在转发器字段中时才有效。我无法从中获取任何信息。
我一直在尝试循环遍历中继器字段,然后运行表的代码,但这似乎不起作用,我从转储中得到的只是NULL。
if( have_rows($table) ): // loop through the rows of data
while ( have_rows($table) ) : the_row();
var_dump($table['information_table'])
endwhile;
else :
// no rows found
endif;
任何人对我如何让表格从转发器字段显示有任何提示?
谢谢。
【问题讨论】:
-
你能发布一些你已经尝试过的代码吗?
-
我使用了链接中发布的代码,并尝试使用:
if( have_rows($table) ): // loop through the rows of data while ( have_rows($table) ) : the_row(); var_dump($table['information_table']) endwhile; else : // no rows found endif;但我从转储中得到了 NULL -
你有没有打电话给
get_sub_field()? -
我也尝试过这样做,但似乎没有任何结果。
标签: php wordpress advanced-custom-fields