Custon Content within WordPress Loop

enter image description here

I have created a WP loop to display Services from ‘Services’ Custom Post Type:

Here is the code:

<?php
    $services_loop = new WP_Query( array( 'post_type' => 'service', 'posts_per_page' => -1 ) );
    if ( $services_loop->have_posts() ) :
        while ( $services_loop->have_posts() ) : $services_loop->the_post(); ?>
          <section class="single-service">
            <div class="container">
                <div class="row">
                    <div class="col-md-6">
                        <?php the_post_thumbnail('full', array('class' => 'img-fluid w-100', 'alt' => get_the_title(), 'title' => get_the_title())); ?>
                    </div>
                    <div class="col-md-6">
                        <h3><?php the_title(); ?></h3>
                        <?php the_content(); ?></div>
                    </div>
                </div>
            </div>
        </section>
        <?php endwhile;
    endif;
    wp_reset_postdata();
?>

It display the list of services. But what I want is, I want to have a custom section within middle of the loop and I am not finding any solution for this. Here I will visualize my problem.

Read more here:: Custon Content within WordPress Loop

Leave a Reply

Your email address will not be published. Required fields are marked *