Support

Account

Home Forums ACF PRO Insert code between get_row_layout() Reply To: Insert code between get_row_layout()

  • Thank you @james for the answer.
    Using your code i can include all the layouts inside a <div class=’row’></div> , but i need to include only the “box” layout inside a <div class=’row’></div>, not all the generated code.

    If i have this code:

    <?php if( have_rows('blocks') ):?>
         <div class="row">
        <?php while ( have_rows('blocks') ) : the_row();?>
            
            <?php if( get_row_layout() == 'full_screen' ):?>
    
               <div class="fullscreen"><!--content--></div>
    
                <?php elseif( get_row_layout() == 'box' ):?>
                  <div class="row">
                          <div class="col-sm-3">
                              <!--content-->
                          </div>
                   </div>
              
               <?php endif;?>
            </div>
        <?php endwhile;
    
    	else :

    We expect the output to be like this:

    <div class="row">
      <div class="fullscreen"><!--content--></div>
      <div class="col-sm-3"><!--content--></div>
      <div class="col-sm-3"><!--content--></div>
    </div>

    But i need this:

    <div class="fullscreen"><!--content--></div>
    <div class="row">
      <div class="col-sm-3"><!--content--></div>
      <div class="col-sm-3"><!--content--></div>
    </div>

    Someone can help me?

    Thank you!