Support

Account

Home Forums Add-ons Repeater Field Repeater different 6 divs

Unread

Repeater different 6 divs

  • Hello to all. This is my current code, where I go to enter a content and every insertion is repeated in the same way, in the correct way. Now, however, I would like to make some changes. I would like this div to be the first of six divs, all different from each other, perhaps with different bootstrap columns, but with the same input from admin. After the sixth insertion, it starts again from the first to make the loop. I hope to have explained and thank you in advance.

    <div class="blocks">
        <?php
    		$terms = get_terms('catproject', array('hide_empty' => false, 'parent'=>0));
    		$count = 1;
      	?>
    	<?php foreach ( $terms as $term ): ?>
      		<div class="services-blocks">
    		<div class="row service-block">
    			<div class="col-sm-6 col-md-offset-2 col-md-6 bs-photo">
    				<div class="cover">
    				  <?php
    					$imageID = get_field('img', 'catproject_' . $term->term_id);
    					if ( $imageID=='' ):
    					  $imageID = get_field('img_default','option');
    					  endif;
    					  $image_url = wp_get_attachment_image_src($imageID,'thumb-block', true);
    					  $imageUrl = wr2x_get_retina_from_url($image_url[0]);
    					  if($imageUrl==''){
    						$imageUrl = $image_url[0];
    					}
    				  ?>
    					<div class="photo" style="background-image: url('<?php echo $imageUrl; ?>"></div>
    				</div>
    			</div>
    			<div class="col-sm-6 col-md-4 col-lg-3 bs-texts">
    				<div class="number">
    				  <?php
    					$count_padded = sprintf("%02d", $count);
    					echo $count_padded;
    				  ?>
    			  	</div>
    				<div class="divider"></div>
    				<h2 class="title"><?php echo $term->name; ?></h2>
    			 	<p class="text"><?php echo wp_trim_words( $term->description, 30, ' [...]' ); ?></p>
    			   <?php
    			  $term_id = $term->term_id;
    			  $taxonomy_name = $term->taxonomy;
    
    			  $termchildren = get_term_children( $term_id, $taxonomy_name );
    foreach ( $termchildren as $child ) :
        $termChild = get_term_by( 'id', $child, $taxonomy_name ); ?>
    	<p class="box-cat-item"><?php echo $termChild->name; ?></p>
    <?php endforeach; unset($termchildren);
    				?>
    
    				<div class="row">
    					<div class="col-sm-12 col-md-8 col-md-offset-2 pt-30">
    						<a class="button discover<?php if( $count%2!=0 ): ?> bott-anim-sx<?php else:?> bott-anim-dx<?php endif;?>" href="<?php echo get_term_link($term); ?>">
    						  <h4><span>Discover</span></h4>
                            </a>
    					</div>
    				</div>
    			</div>
    		</div>
    	</div>
      	<?php
    		$count++;
      	?>
    	<?php endforeach; ?>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.