Home › Forums › Backend Issues (wp-admin) › if function is not working in archeive. php file › Reply To: if function is not working in archeive. php file
1. If select_the_value
is a true/false field, it will already return true/false, so if(get_field('select_the_value'))
should be enough.
2. If select_the_value
is another kind of field (e.g. checkbox or select), 'TRUE'
must be defined as a field option (ergo be a string), otherwise it won’t match
In other words, this might work like this:
$fieldName = get_field('select_the_value') ? 'select_the_country' : 'select_the_city';
the_field($fieldName, $queried_object);
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.