Support

Account

Home Forums Add-ons Repeater Field Image Repeater loop

Solving

Image Repeater loop

    • pb2015

    • March 1, 2017 at 6:30 am

    Hi Everybody.
    I have problem in this loop. I try to use Acf repeater images but dont’t create row and dont’ show images. I add this my code, it work very good. I want add down the main image one carousuel. But most of all i want try to display repeater images

    <?php 
    	
    	 $args = array(
                            'post_type' => 'progetto',
                            'posts_per_page' => -1
                        );
    
                        // Query the posts:
                        $grid_post_types_query = new WP_Query($args);
                        if ($grid_post_types_query->have_posts()) {
                                  $grid_img = '';
                                  $grid_details = '';
                                  $i = 1;
                                  while ($grid_post_types_query->have_posts()) : $grid_post_types_query->the_post();
                                    $image_id = get_post_thumbnail_id();
    								$image_url = wp_get_attachment_image_src($image_id,'progetti');
    								$url = $image_url[0];
    								$image_id = get_post_thumbnail_id();
    								$image_url = wp_get_attachment_image_src($image_id,'full');
    								$url2 = $image_url[0];
                                  	$content = wpautop(get_the_content());
                                 
                                  	
                   	
                                  								  	
                  $grid_img .= ' <li class="gridder-list" data-griddercontent="#gridder-content-' . $i . '"> <img src="' . $url . '" class="img-responsive" /></li>';
    			  $grid_details .= '<div id="gridder-content-' . $i . '" class="gridder-content">
    				<div class="row">
    					
                        <div class="col-sm-6">  <img src=" ' . $url2 . '" class="img-responsive" />  
                     
           
                        here i would like have repeater image </div> 
                       
                        
                        <div class="col-sm-6"> ' . $content . ' </div>  
                        
                     </div> 
                     
                    </div>';
              
                    
                    
                                            $i++;
                                  endwhile;
                               echo  $output = '<div class="container griddercontainer"><ul class="gridder"> ' . $grid_img . '</ul>' . $grid_details . '  </div>';
                        }
                        wp_reset_postdata();
                        wp_reset_query();
                       
              
    	
    	
    	 ?>

    Thanks very much for help me

  • You haven’t given enough information to work with here. All I can really do is point you to the repeater documentation https://www.advancedcustomfields.com/resources/repeater/ and there is other documents as well that explain how to code for a repeater field, for example https://www.advancedcustomfields.com/resources/have_rows/, https://www.advancedcustomfields.com/resources/get_sub_field/ and https://www.advancedcustomfields.com/resources/the_sub_field/

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

The topic ‘Image Repeater loop’ is closed to new replies.

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.