Home › Forums › General Issues › Post Object help › Reply To: Post Object help
Ah, so get_field
does not output the value, to do that you’ll need to either echo it or use the_field
instead:
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php echo get_field('employee_title'); ?>
or
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_field('employee_title'); ?>
For doing conditional fields you’ll just need to wrap it in a conditional like:
<?php if ( $linkedin = get_field( 'linkedin' ) ): ?>
<a href="<?php echo $linkedin; ?>">View LinkedIn</a>
<?php endif; ?>
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.