<div class="services">

                <?php 
                    $args = array( 'post_type' => 'services_list', 'posts_per_page' => 20 );
                    $the_query = new WP_Query( $args ); 
                ?>
                <?php if ( $the_query->have_posts() ) : ?>
                <?php  while ( $the_query->have_posts() ) :   $the_query->the_post();    
                ?>

                        <div class="services_list">
                            <div class="services_list_para">
                                <h3><?php the_title();?></h3>
                                <?php the_content();?>
                            </div>
                            <div class="services_list_image">
                                <?php the_post_thumbnail('full',array('class'=>'img-responsive'));?>
                            </div>
                        </div>

            <?php endwhile;endif;?>

        </div>

above is the wordpress loop i have written.Everything is working fine except the class ‘service_list_para’ is being repeated, this is the html output i am getting:

<div class="services">
  <div class="services_list">
    <div class="services_list_para">
      <h3>the title goes here</h3>
      <div class="services_list_para">
           the content goes here!
      </div>
    <div>
  </div>
</div>

As you can see ,my content is being wrapped inside a div with class services_list_para, if you see my wordpress loop , that is not intended. i want both the title and content get wrapped inside the class ‘services_list_para’, but i am getting this extra div with class ‘services_list_para’ and can’t figure out where that is coming from!

Read more here: wordpress loops repeats a class twice


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: