I am trying to implement tabs in Foundation
http://foundation.zurb.com/docs/components/tabs.html
I would prefer to loop once over the ‘service_title’ to make the titles (i.e. ‘tab 1’) in the ul li the first time around, and then rewind the post’s subfield loop, or whatever you’d call this, to place ‘service_image’ and ‘service_body’ in a lower content div. I suppose I can put everything in a keyed array during the first loop but I would prefer to do this ‘the right way’. Is there a way to reset the counter which is incremented upon every the_row() ? Kind of like a rewind_post but within *one* post.
<ul class="tabs" data-tab>
<li class="tab-title active"><a href="#panel1">Tab 1</a></li>
<li class="tab-title"><a href="#panel2">Tab 2</a></li>
<li class="tab-title"><a href="#panel3">Tab 3</a></li>
<li class="tab-title"><a href="#panel4">Tab 4</a></li>
</ul>
<div class="tabs-content">
<div class="content active" id="panel1">
<p>This is the first panel of the basic tab example. You can place all sorts of content here including a grid.</p>
</div>
<div class="content" id="panel2">
<p>This is the second panel of the basic tab example. This is the second panel of the basic tab example.</p>
</div>
<div class="content" id="panel3">
<p>This is the third panel of the basic tab example. This is the third panel of the basic tab example.</p>
</div>
<div class="content" id="panel4">
<p>This is the fourth panel of the basic tab example. This is the fourth panel of the basic tab example.</p>
</div>
</div>
Actually, there is a function, it appears to be undocumented.
add reset_rows()
after the while loop.
Ah thanks, I will remember that for the future. I just iterated over everything and saved it in arrays, got it working ‘the old fashioned way’. Seems like this should *really* be in documentation because it definitely isn’t!
I dig around in the ACF code quite frequently when I’m trying to figure out if I can do something. Elliot is the only developer working on ACF and the documentation, it’s not surprising that the documentation misses a few of the finer details.