php - Print new row after n divs -


I'm struggling to find a solution to this problem:

  & lt; Php $ counter = 1; While (has_sub_field ('company_members')): echo' & lt; Div class = "row" & gt; '; While ($ counter & lt; = 3): get_template_part ('team-member-box'); ++ counter; Endwhile; Echo & lt; / Div & gt; '; $ Counter = 1; Endwhile; ? & Gt;   

The code I need to do is print out 3 "Team-Member-Box" and then create a new line.

So far all the boxes are composite in the same row.

The code prints the same box for three times, instead, I want to take it 3 elements in the repeater field "company_members" and print the next 3 elements in a new line.

Thank you in advance for your help.

Not sure what it is that you try to do but here in the 3 line of data A common way to display a list is:

  $ counter = 0; Echo & lt; Div class = "row" & gt; '; While (has_sub_field ('company_members')) {echo ($ counter ++% 3 == 0)? '& Lt; / Div & gt; & Lt; div class = "row" & gt; : ''; Get_template_part ('teammate box'); } Echo & lt; / Div & gt; ';  Explained:   Explained: > This explains all the company_email members, I think that using  get_template_part  current item, some HTML Offers.  the_sub_field ('content')  in the above link  

$ counter is not related to the above behavior, the result is only to divide the fragmentation of 3 and Used to wrap in divs.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -