Home Forums ACF PRO Repeater Sub Field Select Box


Repeater Sub Field Select Box

  • Hi guys, so I’m using a theme built on bootstrap and one of the custom fields i need is a repeater field with some subfields to build service panels. Problem is I cannot get a select field to display on the front end as one of the subfields. The current code below.

    In this instance the field in question is called $service_panel_colour, allowing the user to change the background and border colours of a panel.

    I’m clearly missing something so any guidance would be awesome, thanks.

    <div class="row">
       <!-- check if custom field has rows -->
       <?php if( have_rows('services') ): ?>
    	  <!-- while custom field has rows -->
    	  <?php while( have_rows('services') ): the_row(); 
    		// variables for sub field values
    		$service_panel_colour = get_sub_field('service_panel_colour');
    		$service_icon = get_sub_field('service_icon');
    		$service_heading = get_sub_field('service_heading');
    		$service_content = get_sub_field('service_content');
    		$service_read_more_link = get_sub_field('service_read_more_link');
    		<div class="col-md-3 col-sm-6 col-xs-6">
    			<div class="<?php echo $service_panel_color['value']; ?>">
    				<div class="service-icon">
    					<span><i class="<?php echo $service_icon; ?>"></i></span>
    				<div class="service-content">
    					<h3 class="title"><?php echo $service_heading ?></h3>
    					<p class="description"><?php echo $service_content; ?></p>
    					<a href="<?php echo $service_read_more_link['url']; ?>" class="read-more fa fa-plus" data-toggle="tooltip" title="Read More"></a>
    			</div><!--/ end serviceBox -->
    	  <?php endwhile; ?>
    	<?php endif; ?>						
  • The first thing you need to figure out is what the field is returning.

    Somewhere inside the div add
    <?php var_dump($service_panel_colour); ?>
    and let me know what is output

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

The topic ‘Repeater Sub Field Select Box’ is closed to new replies.