Home › Forums › General Issues › Let users add to select field choices › Reply To: Let users add to select field choices
If you make the field Required, then you can do away with the if statement completely <?php $manufacturer = get_field('manufacturer'); echo $manufacturer->name; ?>
. Otherwise you can shorten the notation a bit like this: <?php $manufacturer = get_field('manufacturer'); if( $manufacturer ) echo $manufacturer->name; ?>
. If you’re doing more than just echoing the name within the statement then stick in curly braces.
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.