Home › Forums › Front-end Issues › Displaying a field that is conditional to another › Reply To: Displaying a field that is conditional to another
Yes I definitely think the code I wrote wont work.
What I need is to display a field that has conditional logic to another.
I have a list of brands and models. To display brand is easy I just use <?php the_field(‘brand’) ?>
Now to display a model that has a conditional logic to that brand, that is when I find myself in trouble.
With your help I managed echo the name of the field.
<?php
$brand = get_field(‘brand’);
$model = “model_”;
$model_brand = $model . $brand;
echo $model_brand;
?>
What I need is a way to use this stored in the new variable “model_brand” to get the field “model_brand” to give you an example the field could be named “model_ford”. I am not sure this is the right path, probably not. But I imagine there has to be a way to display a field with conditional logic, right?
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.