I want to show posts in index page but just the first one is shown!this is the code:

<div class="w3ls">
   <?php if(have_posts()):
      while (have_posts()) : the_post();
   <div class="col-md-6 w3ls-right wow fadeInDown"  data-wow-duration=".8s" data-wow-delay=".2s">
       <div class="tc-ch">
          <div class="tch-img">
             <a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url(); ?>" style=" width: 400px !important; height: 300px !important;" alt=""/></a>
            <h3><a href="singlepage.html">
                 <?php the_title(); ?>
                <h6>توسط <a href="singlepage.html">
                    <?php the_author() ?></a><?php the_date() ?></h6>
                    <p><?php the_excerpt(); ?></p>
                        <div class="bht1">
                           <a href="singlepage.html">ادامه مطلب</a>
                        <div class="soci">
                            <li class="hvr-rectangle-out"><a class="twit" href="#"></a></li>
                            <li class="hvr-rectangle-out"><a class="drib" href="#"></a></li>
                        <div class="clearfix"></div>
      <?php endwhile; ?>
      <?php endif; ?>
        <div class="clearfix"></div>

what is the problem?

  • It looks like a standard post loop, have you checking the reading settings that it isn't set to 1 post per page? Is there a query_posts call above this code? I'm assuming this is index.php in your theme? – Tom J Nowell Jun 2 at 10:41
  • no I didn't set any number and there is no query_posts and yes It's index.php – hadis Jun 2 at 11:05
  • There should always be a number there, if none is set, set one. Can you confirm that changing it to 10 shows 10 or does not show 10 posts? – Tom J Nowell Jun 2 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.