Guest User

Untitled

a guest
Sep 22nd, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <!--Start Grid -->
  2.   <div class="uk-grid <?php if($gutter !=""){echo $gutter;}?>">
  3.     <?php
  4.     if ( have_rows('blocks') ):
  5.       // loop through the rows of data
  6.       while ( have_rows('blocks') ) : the_row();
  7.  
  8.       //Retrieve Variables from Repeater Feild Blocks
  9.       $content = get_sub_field('body_content');
  10.  
  11.       $smallWidth = get_sub_field('small_width');
  12.       $mediumWidth = get_sub_field('medium_width');
  13.       $largeWidth = get_sub_field('large_width');
  14.       $customStyle = get_sub_field('custom_styles');
  15.  
  16.       $styles = array();
  17.  
  18.       if($smallWidth != "" || $mediumWidth != "" || $largeWidth != ""){
  19.         array_push($styles, $smallWidth, $mediumWidth, $largeWidth);
  20.       }
  21.  
  22.       //Building out HTML for Grid element
  23.       ?>
  24.       <div class="<?php foreach($styles as $style){echo $style ." ";}?>" <?php if($customStyle != ""){echo 'style="'.$customStyle.'"';}?>>
  25.         <?php echo $content?>
  26.       </div>
  27.       <?
  28.       endwhile;
  29.  
  30.     else :
  31.       echo 'No Rows Found. Please add some.';
  32.     endif;
  33.  
  34.     ?>
  35. </div> <!--End Grid -->
Advertisement
Add Comment
Please, Sign In to add comment