按字段值过滤重力形式条目
Filter Gravity Forms Entries by field value
我正在尝试输出重力形式条目列表,但只想输出在特定字段中具有特定值的条目。
例如,$entry['53'] 是表单中的一个字段,允许用户从下拉列表中 select。只有两个选择。假设 A 和 B。我将如何更改下面的代码以仅显示值为 B 的条目?
我现在的密码是:
<?php
//Get the Form ID to get the entries from and store it within a varibale
$search_criteria = null;
$sorting = null;
$paging = null;
$entries = GFAPI::get_entries( $form_id, $search_criteria, $sorting, $paging );
echo '<ul>';
foreach($entries as $entry) :
echo '<li>Title: ' . $entry['2'] . '</li>';
endforeach;
echo '</ul>';
?>
非常感谢
试试这个:
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
array(
'key' => '53',
'value' => 'B',
),
)
);
我正在尝试输出重力形式条目列表,但只想输出在特定字段中具有特定值的条目。
例如,$entry['53'] 是表单中的一个字段,允许用户从下拉列表中 select。只有两个选择。假设 A 和 B。我将如何更改下面的代码以仅显示值为 B 的条目?
我现在的密码是:
<?php
//Get the Form ID to get the entries from and store it within a varibale
$search_criteria = null;
$sorting = null;
$paging = null;
$entries = GFAPI::get_entries( $form_id, $search_criteria, $sorting, $paging );
echo '<ul>';
foreach($entries as $entry) :
echo '<li>Title: ' . $entry['2'] . '</li>';
endforeach;
echo '</ul>';
?>
非常感谢
试试这个:
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
array(
'key' => '53',
'value' => 'B',
),
)
);