Support

Account

Forum Replies Created

  • How did you solve this? I am having the same issue.

  • Hi, I used your code but was having issues. I was able to solve it using:

    echo '<ul class="nav nav-pills" id="pills-tab" role="tablist">';
    
    		$child_repeater = get_field('section_two');
    
    		//$count=0;
    		//// first loop
    		foreach($child_repeater as $item) {
    
    		    $tab_title = $item['tab_heading'];
    
    		    $tab_id = str_replace(' ', '-', strtolower( $tab_title ) ); 
    
    		    if (!is_null($tab_title)) {
    		 
    			 	echo '<li class="nav-item"><a class="nav-link ';
    
    			 	if( !$count) {
    
    			     	echo 'active';
    
    			    } 
    
    			    echo  '" href="#pills-' . $tab_id . '" data-toggle="tab" id="pills-"' . $tab_id . '"  aria-controls="' . $tab_id . '"  aria-expanded="true">' . $tab_title . '</a></li>';
    
    			    $count++;
    		    }
    		}
    
    	echo '</ul>';
    
    echo '</div>';
    
    echo '<div class="tab-content col-12" id="pills-tabContent">';
    
    	$i=0;
    	// second loop
    	foreach($child_repeater as $item) {
    
    	    $tab_title = $item['tab_heading'];
    
    	    $tab_id = str_replace(' ', '-', strtolower( $tab_title ) );
    
    	    $image = $item['tab_image'];
    	    
    	    $content = $item['tab_content'];
    
    	    if (!is_null($content)) {
    
    		    echo '<div class="tab-pane fade ';
    		    if( !$i) {
    		     	echo 'show active';
    		    } 
    		    echo '" id="pills-' . $tab_id . '">';
    
    			    echo '<div class="card mb-3">';
    			    
    			    	echo '<img src="' . $image . '" alt="' . $tab_title . ' ">';
    
    			    	echo '<div class="card-body">';
    
    			    		echo  $content;
    
    			    	echo '</div>'; 
    
    			    echo '</div>'; 
    
    		    echo '</div>'; 
    
    		    $i++;
    		 }
    	}
Viewing 2 posts - 1 through 2 (of 2 total)