Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

313
Views
Add dynamic id to custom row

I created a custom grid to have this display :

enter image description here

Now i need to add an id (with an incremental number) to every row so i can use it as anchor. I tried to regroup every three blocs in one div but i couldn't do it.

    <?php
    if ( $query->have_posts() ) {
      while ( $query->have_posts() ) : $query->the_post(); ?>

        <?php if ($i % 3 == 0) { ?>
              <div class="projet-bloc-empty col-md-4"><div></div></div>
              <div class="projet-bloc-empty col-md-4"><div></div></div>
              <div class="projet-bloc-empty col-md-4"><div></div></div>
        <?php } ?>

        <div class="projet-bloc col-md-4">
            <a href="<?php echo $post->post_name ?>" title="<?php echo $post->post_title ?>">
                <?php echo get_the_post_thumbnail($post->ID); ?>
            </a>
        </div>
      
      <?php $i++; endwhile; ?>
    <?php } ?>
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!