Home › Forums › Backend Issues (wp-admin) › Show Ninja Form if True/False? › Reply To: Show Ninja Form if True/False?
I’m not sure I completely understand.
Is the true/false field displayed on the ninja forms post type for each submission?
If that is the case I’m not sure I can tell what value in your code represents the post_id of each submission. Is it $form_id?
If you have this attached to the form post type and $form_id represents the post ID then maybe something like the below.
Keep in mind that this is only a quess, this is really an ninja forms question.
<?php
$args = array(
'6' => $form_id,
'fields' => array(),
);
$subs = Ninja_Forms()->subs()->get( $args );
foreach ($subs as $sub) {
$form_id = $sub->form_id;
if (get_field('name_of_true_false_field', $form_id)) {
// Returns an array of [field_id] => [user_value] pairs
$all_fields = $sub->get_all_fields();
// Echoes out the submitted value for a field
echo '<li><div class="testimonial"><span class="testimonial-stars">'.
$sub->get_field(9).'</span> stars<br>'.$sub->get_field (10);
echo '<div class="reviewer">-'.$sub->get_field( 7 ).
', ' . $sub->get_field( 8 ) . '</div></div></li>';
}
}
?>
If that’s not right, please supply more information.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.