Title: Loop wordpress doesn&#039;t work
Last modified: August 21, 2016

---

# Loop wordpress doesn't work

 *  [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/)
 * Hello everybody !
    the Loop wordpress : <?php if(have_posts()) : ?><?php while(
   have_posts()) : the_post(); ?> <?php the_content(); ?>
 * the code works in the index page, all article are schown, but in another page(
   for example page.php or archive.php), nothing happens !
    If i put the code <?
   php echo (‘we are in the loop’) ?> after the if, it appears correctly.
 * Do i need to do something special ? Maybee i missed something. My loop works 
   in index page but not in another.
 * Thanks for you help !

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Darshan](https://wordpress.org/support/users/darshanpatel/)
 * (@darshanpatel)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068095)
 * Hello Melka
 * Create one Page template and try this code.
 * <?php if (have_posts()) : while (have_posts()) : the_post();?>
    <div class=”post”
   > <h2 id=”post-<?php the_ID(); ?>”><?php the_title();?></h2> <div class=”entrytext”
   > <?php the_content()?> </div> </div> <?php endwhile; endif; ?>
 *  Thread Starter [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068102)
 * ok i did it and this is the source code of the page …:/
 * <div class=”post”>
    <h2 id=”post-10″>ontest</h2> <div class=”entrytext”> </div
   > </div>
 *  Thread Starter [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068103)
 * if i m in another page than index.php the loop doesn’t work.
 *  [Darshan](https://wordpress.org/support/users/darshanpatel/)
 * (@darshanpatel)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068106)
 * Used your own Source code
    <?php if(have_posts()) : ?><?php while(have_posts()):
   the_post(); ?> <?php the_content(); ?>
 * in these code close WHILE loop and IF condition.
 * if these code not work then _[direct contact solicitation moderated – please 
   keep the support in the forum]_ and solve the problem.
 *  Thread Starter [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068119)
 * Hello Darshan
    how do you want to chat ? do you have skype ? Here is my email:_[
   email address moderated – these forums do not provide support via email] _ Thanks
   a lot for your help, i ll hope we’ll fix the problem.
 *  [Darshan](https://wordpress.org/support/users/darshanpatel/)
 * (@darshanpatel)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068121)
 * _[direct contact solicitation moderated – please keep the support in the forum]_
   Thanks
 *  Thread Starter [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068133)
 * _[email address moderated – these forums do not provide support via email] _
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068135)
 * **[@melka34](https://wordpress.org/support/users/melka34/)**: Please do not solicit
   contact via email. Posting your email address or asking others to contact you
   off forums is _really_ frowned upon here. This is to protect users and to prevent
   people from trying to solicit work or harvest email addresses from the forums.
 * Additionally, the point of these community-based forums is to help each other
   _in a public space_ so that the whole community can benefit from the discussion
   and any solutions proposed. Private discussions take this benefit away. If you
   would prefer a one-to-one discussion, please try [http://directory.codepoet.com/](http://directory.codepoet.com/)
   or [http://jobs.wordpress.net/](http://jobs.wordpress.net/)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068140)
 * for page tempaltes, you need to add a custom query before the loop;
 * [http://codex.wordpress.org/Page_Templates](http://codex.wordpress.org/Page_Templates)
 * example:
    [http://codex.wordpress.org/Page_Templates#A_Page_of_Posts](http://codex.wordpress.org/Page_Templates#A_Page_of_Posts)
 *  Thread Starter [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068147)
 * Here is the website page with the loop
    [https://blog.supagro.inra.fr/capeye/archives/](https://blog.supagro.inra.fr/capeye/archives/)
 *  Thread Starter [melka34](https://wordpress.org/support/users/melka34/)
 * (@melka34)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068164)
 * Ok thanks Alchimyth, i can’t create 2 loops, i can only modify the exciting 1.
   
   If i want to create another loop, i can also use WP_Query class.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Loop wordpress doesn't work’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 4 participants
 * Last reply from: [melka34](https://wordpress.org/support/users/melka34/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/loop-wordpress-doesnt-work/#post-5068164)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
