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!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.