Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:19:05+00:00 2026-06-10T13:19:05+00:00

I have created a simple WordPress loop already but now it should loop a

  • 0

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.

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

Here is the code:
<code>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if(get_field('artist-repeater')): while(has_sub_field('artist-repeater')): ?>

<div class="item-row-wrap"> <!--START of item-row-wrap-->

    <div class="vinyl-wrap"> <!--START of vinyl-wrap-->
        <?php if(get_sub_field('play-repeater-songlink')): ?>
            <a class="play" href='<?php the_sub_field('play-repeater-songlink'); ?>' target="_blank"></a>
        <?php endif; ?>
        <?php if(get_sub_field('moreinfo-repeater-song')): ?>
            <a class="more-info" href='<?php the_sub_field('moreinfo-repeater-song'); ?>' target="_blank"></a>
        <?php endif; ?>
        <div class="vinyl-cover">
            <div class="vinyl-cover-plastik"></div>
             <?php if(get_sub_field('album-repeater-image')): ?>
             <?php $image = wp_get_attachment_image_src(get_sub_field('album-repeater-image'), 'thumbnail'); ?>
             <img class="album-cover-art" src="<?php echo $image[0]; ?>" alt="<?php get_the_title(get_field('album-repeater-image')) ?>" />
             <?php endif; ?>
        </div> <!--End of vinyl-cover-->
        <div class="likeit">
            <?php if(function_exists(getILikeThis)) getILikeThis('get'); ?>
        </div>
        <div class="artist-name-wrap">
            <div class="artist-wrap-left"></div>
            <div class="artist-wrap-mid">
                <p><?php the_title(); ?></p>
            </div>
            <div class="artist-wrap-right"></div>
        </div> <!--End of artist-name-wrap-->
        <div style="clear:both;"></div>
        <div class="song-name-wrap">
            <div class="song-wrap-left"></div>
            <div class="song-wrap-mid">
                <?php if(get_sub_field('song-repeater-name')): ?>
                    <p><?php the_sub_field('song-repeater-name'); ?></p>
                <?php endif; ?>
            </div>
            <div class="song-wrap-right"></div>
        </div> <!--end of song-name-wrap-->


    </div> <!--END OF VINYL-WRAP-->


        <?php endwhile; endif; ?>

    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php else: ?>
        Yht&auml;&auml;n artikkelia ei ole viel&auml; julkaistu.
    <?php endif; ?>

</div> <!--END OF ITEM-ROW-WRAP-->

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:19:07+00:00Added an answer on June 10, 2026 at 1:19 pm

    Make $i var before the loop.
    Up the value just before the loops closes: $i++
    Set a Modulo check around the <div class="item-row-wrap"> (and the closing </div>)

    Modulo tutorial

    Not a complete answer but enough to get you started.

    example
    The example below shows how you should do this

    <?php
    $i = 0;
    if (have_posts()) : while (have_posts()) : the_post();
    if(get_field('artist-repeater')): while(has_sub_field('artist-repeater')):
    
        if ($i % 3 == 0) {
            echo '<div class="item-row-wrap"> <!--START of item-row-wrap-->';
        }
        $i++; // up the numer of looped
    ?>
    DO your magic
    <?php
        if ($i % 3 == 0) {
            echo '</div> <!--END OF ITEM-ROW-WRAP-->';
        }
    
    
    endwhile; //end have_posts()
    endif;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple WordPress plugin that automatically sets my new sites up
We all know that wordpress have simple .htaccess code like below RewriteEngine on RewriteBase
I have a WordPress blog on my website. But I've created my own page
I have created simple script: #!/bin/sh column=${1:-1} awk '{colawk='$column'+1; print colawk}' But when I
I have created a simple WordPress page template. I am working on live server.
Could someone help me on this, I have created simple web services using axis2
How to manually create Friendly URLs? (PHP) So I have created simple php file
I am new to Repository concept and get some questions. I have created simple
I have created the simple web service. Code: [ServiceContract] public interface ITsdxService { [OperationContract]
I have created this simple program to learn shared_ptr using namespace std; #define Yes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.