Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress loop count
    primarykey
    data
    text
    <p>I have created a simple Wordpress loop already but now it should loop a little differently and i dont know how to start or even where to start. I have inside DIV class="item-row-wrap" my loop it loops through DIV class="vinyl-wrap" normally. </p> <p>My problem: i would like it to loop three times and then to create a new DIV class="item-row-wrap" and start again looping DIV class="vinyl-wrap" three times...and go on and on</p> <pre><code>Here is the code: &lt;code&gt; &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;?php if(get_field('artist-repeater')): while(has_sub_field('artist-repeater')): ?&gt; &lt;div class="item-row-wrap"&gt; &lt;!--START of item-row-wrap--&gt; &lt;div class="vinyl-wrap"&gt; &lt;!--START of vinyl-wrap--&gt; &lt;?php if(get_sub_field('play-repeater-songlink')): ?&gt; &lt;a class="play" href='&lt;?php the_sub_field('play-repeater-songlink'); ?&gt;' target="_blank"&gt;&lt;/a&gt; &lt;?php endif; ?&gt; &lt;?php if(get_sub_field('moreinfo-repeater-song')): ?&gt; &lt;a class="more-info" href='&lt;?php the_sub_field('moreinfo-repeater-song'); ?&gt;' target="_blank"&gt;&lt;/a&gt; &lt;?php endif; ?&gt; &lt;div class="vinyl-cover"&gt; &lt;div class="vinyl-cover-plastik"&gt;&lt;/div&gt; &lt;?php if(get_sub_field('album-repeater-image')): ?&gt; &lt;?php $image = wp_get_attachment_image_src(get_sub_field('album-repeater-image'), 'thumbnail'); ?&gt; &lt;img class="album-cover-art" src="&lt;?php echo $image[0]; ?&gt;" alt="&lt;?php get_the_title(get_field('album-repeater-image')) ?&gt;" /&gt; &lt;?php endif; ?&gt; &lt;/div&gt; &lt;!--End of vinyl-cover--&gt; &lt;div class="likeit"&gt; &lt;?php if(function_exists(getILikeThis)) getILikeThis('get'); ?&gt; &lt;/div&gt; &lt;div class="artist-name-wrap"&gt; &lt;div class="artist-wrap-left"&gt;&lt;/div&gt; &lt;div class="artist-wrap-mid"&gt; &lt;p&gt;&lt;?php the_title(); ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="artist-wrap-right"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!--End of artist-name-wrap--&gt; &lt;div style="clear:both;"&gt;&lt;/div&gt; &lt;div class="song-name-wrap"&gt; &lt;div class="song-wrap-left"&gt;&lt;/div&gt; &lt;div class="song-wrap-mid"&gt; &lt;?php if(get_sub_field('song-repeater-name')): ?&gt; &lt;p&gt;&lt;?php the_sub_field('song-repeater-name'); ?&gt;&lt;/p&gt; &lt;?php endif; ?&gt; &lt;/div&gt; &lt;div class="song-wrap-right"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!--end of song-name-wrap--&gt; &lt;/div&gt; &lt;!--END OF VINYL-WRAP--&gt; &lt;?php endwhile; endif; ?&gt; &lt;?php endwhile; ?&gt; &lt;?php wp_reset_query(); ?&gt; &lt;?php else: ?&gt; Yht&amp;auml;&amp;auml;n artikkelia ei ole viel&amp;auml; julkaistu. &lt;?php endif; ?&gt; &lt;/div&gt; &lt;!--END OF ITEM-ROW-WRAP--&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload