Title: running a loop
Last modified: August 21, 2016

---

# running a loop

 *  Resolved [Paul Goethe](https://wordpress.org/support/users/paul-goethe/)
 * (@paul-goethe)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/running-a-loop-1/)
 * Iam into a loop for running all post with one concrete category.
    I have this:
   $postID = get_the_ID();
 * (My ID’s are 50, 60 & 70)But if I print ‘$postID’ I obtain this values:
    50, 
   5060 , 506070
 * I need obtain 50, 60 & 70. Separatelly.
 * I would need create an loop for can print this values separetly. For example 
   like this:
    [0]= 50 [1]= 60 [2]= 70
 * Do you understand me?
    Im really gratefully for the help.

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/running-a-loop-1/#post-3957176)
 * Try using an array. Example:
 *     ```
       <?php $postID = array(); ?>
       <!-- the loop -->
       <?php while ( have_posts() ) : the_post(); ?>
   
       <!-- inside the loop -->
       <?php $postID[] = get_the_ID(); ?>
   
       <?php endwhile; ?>
       <?php
       // print the ids
       if ( !empty( $postID ) ) {
       	foreach ( $postID as $id ) {
       		echo 'post id = ' . $id;
       	}
       }
       ?>
       ```
   
 * [http://php.net/manual/en/language.types.array.php](http://php.net/manual/en/language.types.array.php)
 *  Thread Starter [Paul Goethe](https://wordpress.org/support/users/paul-goethe/)
 * (@paul-goethe)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/running-a-loop-1/#post-3957224)
 * Ohh!
 * I go to try now!
    You did understand perfectly my problem.
 * Thank’s very much!
 * When I try this I will tell you if the problem is resolved.
 * Cheers
 *  Thread Starter [Paul Goethe](https://wordpress.org/support/users/paul-goethe/)
 * (@paul-goethe)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/running-a-loop-1/#post-3957229)
 * It’s perfect!
    Thank you very much! I was very bloqued but now is resolve.
 * Cheers!
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/running-a-loop-1/#post-3957230)
 * You’re welcome. I’m glad you’ve got it resolved 🙂

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

The topic ‘running a loop’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/running-a-loop-1/#post-3957230)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
