How to implode two individual fields:
I also want to hide h2 if both fields are empty. I’m not sure where to put php tags?
if (get_field('father') {
$values[] = get_field('father');
}
if (get_field('mother') {
$values[] = get_field('mother');
}
if (!empty($values)) {
echo implode(', ', $values);
}
sorry this is not working, or i dont know where to put <?php code.
Thanks for your support,
Now I have adopted relationship for my output and this question has resolved half of my problem.
now I also want get_permalink( $person->ID ):
<a href="<?php echo get_permalink( $person->ID ); ?>">
<?php echo get_the_title( $person->ID ); ?>
</a>
so that those values can linked to their respective post.
I’m simply using text fields (first option in the plugin)
Actually I’m looking for…
If this, this and this value is available then show them all (inline with comma separated)
Otherwise show any available value (without any comma)
I hope you understand this time.
Thanks
Can you use media queries for mobile screen
Can you show your code
Hi,
Please see this for better understanding: https://infoobox.com/person/sunil-butolia
Currently user can fill their parents details in single text box but I want to create separate for mother and father and want to show in single line as mentioned in above link.
But what if someone only fills one details mother or father then how to remove ‘comma’.
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.