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

---

# Running a loop

 *  [Paul Goethe](https://wordpress.org/support/users/paul-goethe/)
 * (@paul-goethe)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/running-a-loop/)
 * Hello,
 * Have if I can help traverse an array, I blocked here
    I’m in a page, running 
   a loop that gives me posts with a certain category. What I need is to get all
   the ID of those posts, but separately. This is what I have>
 * _[please read [http://codex.wordpress.org/Forum\_Welcome#Posting\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)
   for posting code; the code below is either unreadable or corrupted]_
 * <? php query_posts (‘category_name = skatepark’);?>
    <? php if (have_posts ()):
   while (have_posts ()): the_post ();?> <? php $ postIDSkate = get_the_ID (); $
   postIDSkateA = explode (”, $ postIDSkate); echo $ postIDSkateA [0] ?> <? php 
   endwhile;?> <? php endif;?>
 * >>>>>>>>>>
 * Okay, so I printed three numbers that are the 3 ID that I have.
    Now I need to
   cross it again to give me
 * echo $ postIDSkateALoop [0] = first number
    echo $ postIDSkateALoop [1] = second
   number echo $ postIDSkateALoop [2] = Third number
 * What I can do???
    Thank you so much!

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/running-a-loop/#post-3946797)
 * it is not really clear to me what you are trying to achieve;
    maybe start by 
   explaining your goal in more detail.
 * also, please repost your code.
 *  Thread Starter [Paul Goethe](https://wordpress.org/support/users/paul-goethe/)
 * (@paul-goethe)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/running-a-loop/#post-3946806)
 * Sorry, but my english is very poor. I will try explining again …
 * Iam into a loop for running all post with one concrete category.
    I have this:
   $postID = get_the_ID();
 * And I print this:
    echo $postID[0];
 * (My ID’s are 50, 60 & 70)But I obtain:
    50, 5060 , 506070
 * I need obtain 50, 60 & 70. Separatelly.
 * I would need create an array for can print this values separetly. For example
   like this:
    [0]= 50 [1]= 60 [2]= 70
 * Do you understand me?
    Im really gratefully. Chears

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

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

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [development](https://wordpress.org/support/topic-tag/development/)
 * [loops](https://wordpress.org/support/topic-tag/loops/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Paul Goethe](https://wordpress.org/support/users/paul-goethe/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/running-a-loop/#post-3946806)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
