Title: PhP Call Help
Last modified: August 19, 2016

---

# PhP Call Help

 *  [uspinnak](https://wordpress.org/support/users/uspinnak/)
 * (@uspinnak)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-call-help/)
 * I am trying to set up a 2 column system. I can get the two column just fine but
   the problem is they repeat the same posts. Is there a way I can have one column
   pull the first 6 and the second to pull the next 6? I am using this as my code:
 * <?php
    $my_query = new WP_Query(‘category_name= ‘. $category .’&showposts=6’);
   while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $
   post->ID; ?>
 * I am using this code in 2 separate divs to create the two columns.

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

 *  [Wex](https://wordpress.org/support/users/wex/)
 * (@wex)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-call-help/#post-1343689)
 * Assuming that the bit of code that you posted works for the 6 posts, a quick 
   fix would be something like this…
 *     ```
       <?php $my_query = new WP_Query('category_name= '. $category .'&showposts=12'); $postNumber = 0;
   
       while ($my_query->have_posts() && $postNumber < 6) : $my_query->the_post();$do_not_duplicate = $post->ID; ?>
       <!-- Sidebar 1 Code Here -->
       <?php $postNumber++; endwhile; ?>
   
       while ($my_query->have_posts() && $postNumber < 12) : $my_query->the_post();$do_not_duplicate = $post->ID; ?>
       <!-- Sidebar 2 Code Here -->
       <?php $postNumber++; endwhile; ?>
       ```
   
 *  Thread Starter [uspinnak](https://wordpress.org/support/users/uspinnak/)
 * (@uspinnak)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-call-help/#post-1343699)
 * Thanks for that help I didn’t even think of that. I modified it a little bit 
   to try and get the call to pull one category per category page instead of information
   from all the most recent posts. I changed the code to this assuming that it would
   just pull directly from category information.
 *     ```
       if (have_posts()) : query_posts('posts_per_page=12');
       while (have_posts() && $postNumber < 6) : the_post();$do_not_duplicate = $post->ID; ?>
       ```
   

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

The topic ‘PhP Call Help’ is closed to new replies.

## Tags

 * [columns](https://wordpress.org/support/topic-tag/columns/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 2 participants
 * Last reply from: [uspinnak](https://wordpress.org/support/users/uspinnak/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/php-call-help/#post-1343699)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
