Support

Account

Home Forums Add-ons Repeater Field Pulling in a repeater field, into a post object repeater field Reply To: Pulling in a repeater field, into a post object repeater field

  • This seems to work, might be a bit bloated for now, but it is working properly

    <?php 
    		
    if(have_rows('featured_solutions')){
    	
    	while (have_rows('featured_solutions')) {
    		the_row();
    		
    		$featured_sol = get_sub_field('featured_solution');
    		if($featured_sol){
    			
    			$fsolimage = get_field('page_thumbnail', $featured_sol->ID);
    			$fsollink = get_permalink($featured_sol->ID);
    			$fsoltitle = get_the_title($featured_sol->ID);
    			//$fsolsizes = get_field('product_size' , $featured_sol->ID);
    			//$pipesize = get_sub_field('pipe_size' , $featured_sol->ID);
    			//$fsoapproval = get_sub_field('approval' , $featured_sol->ID);
    			//$fsolapprovals = get_field('product_approval' , $featured_sol->ID , $fsoapproval[0]);
    			
    		}
    		
    			
    		
    		
    		echo '<div class="solutionItem">
                    <div class="siImage" style="background-image:url(' . $fsolimage . ');"><h3 class="">' . $fsoltitle . '</h3></div>
                    <div class="siPad">
                        <div class="siCopy">
                            <div class="siTop">
                                <span>Applications</span>
    							<p>';
                                $categories = wp_get_post_categories( $featured_sol->ID , array('child_of' => 10 ));
    							//loop through them
    							foreach($categories as $c){
    							  $cat = get_category( $c );
    							  //get the name of the category
    							  $cat_id = get_cat_ID( $cat->name );
    							  //make a list item containing a link to the category
    							  $applications = $cat->name;
    							  echo $applications. '<br />';
    							}
                           echo '</p>
    						</div>
                            <div class="siLeft">
                                <span>Sizes</span>
    							<p>';
                                if(get_field('product_size' , $featured_sol->ID)){
    								while(has_sub_field('product_size' , $featured_sol->ID)){
    									echo the_sub_field('pipe_size' , $featured_sol->ID) . '<br />';
    									}
    								}
                            echo '</p>
    						</div>
                            <div class="siRight">
                                <span>Approvals</span>
    							<p>';
                                if(get_field('product_approval' , $featured_sol->ID)){
    								while(has_sub_field('product_approval' , $featured_sol->ID)){
    									echo the_sub_field('approval' , $featured_sol->ID) . '<br />';
    									}
    								}
                            echo '</p>
    						</div>
                            <div class="breakline"></div>
                            <div class="siCTA">
                                <div class="ctabutton primary"><a href="' . $fsollink . '">learn more</a></div>
                            </div>
                        </div>
                    </div>
                </div> ' ;
    		
    	}	
    	
    } 
    ?>