• I have the following code, where in wordpress do i add it to make it work for every third post?

    <?php

    $counter = 1;

    while ( have_posts() ) : the_post();

    get_template_part( ‘content’, get_post_format() );

    if( $counter === 3 ) { ?>
    <div class=”third-div-in-loop”>content</div>
    <?php }

    $counter++;

    endwhile;

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘code every third post’ is closed to new replies.