Support

Account

Forum Replies Created

  • Ah I get it! Didn’t think it would be that easy πŸ™‚

    Thanks very much @elliot

  • 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

Viewing 4 posts - 1 through 4 (of 4 total)