No problem π
Hi Brad, if the values in the “description” dropdown already match your CSS classes (for ease, it would be good if they did), then can you just do something like this:
<ul>
<?php
while( the_repeater_field(thp_coach) ) {
?>
<li class=βthp-member <?php the_sub_field('description'); ?>β>
<img src=β<?php the_sub_field('photo'); ? />β>
<h4><?php the_sub_field('name'); ?></h4>
<p><?php the_sub_field('description'); ?></p>
</li>
<?php } ?>
</ul>
Basically just adding the “description” dropdown value as a class to the <li>
.
You’d then just end up with something like:
<li class="thp-member gold"></li>
No ‘if’ statement required π
Hi @elliot,
Thank you for replying. I should point out that my PHP knowledge isn’t that great(!). I did however get the following output:
Array
(
[field_51e6a66b8509b] => Array
(
[label] => Client name
[name] => client_name
[type] => text
[instructions] =>
[column_width] =>
[default_value] =>
[formatting] => html
[order_no] => 0
[key] => field_51e6a66b8509b
)
[field_51e6a6788509c] => Array
(
[label] => Client logo
[name] => client_logo
[type] => image
[instructions] =>
[column_width] =>
[save_format] => url
[preview_size] => thumbnail
[order_no] => 1
[key] => field_51e6a6788509c
)
[field_51e6a6878509d] => Array
(
[label] => Images
[name] => images
[type] => repeater
[instructions] =>
[column_width] =>
[sub_fields] => Array
(
[field_51e6a69f8509e] => Array
(
[label] => Large image
[name] => large_image
[type] => image
[instructions] =>
[column_width] =>
[save_format] => url
[preview_size] => thumbnail
[order_no] => 0
[key] => field_51e6a69f8509e
)
[field_51e9070105abe] => Array
(
[choices] => Array
(
[kitchen] => Kitchen
[lounge] => Lounge
[hallway] => Hallway
[meeting_room] => Meeting Room
[bathroom] => Bathroom
[reception] => Reception
[bedroom] => bedroom
)
[label] => Location
[name] => location
[type] => select
[instructions] =>
[column_width] =>
[default_value] =>
[allow_null] => 0
[multiple] => 0
[order_no] => 1
[key] => field_51e9070105abe
)
)
[row_min] => 0
[row_limit] =>
[layout] => table
[button_label] => Add Row
[order_no] => 2
[key] => field_51e6a6878509d
)
)
What I basically want is to output the ‘choices’ array from the above. I’ve taken a look into multidimensional arrays and understand them (ish!), but not when they’re this deep. Do you know how I can output the ‘choices’?
Thanks again
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.