Title: Paged loop over 2 columns
Last modified: August 19, 2016

---

# Paged loop over 2 columns

 *  [jobmeer](https://wordpress.org/support/users/jobmeer/)
 * (@jobmeer)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/paged-loop-over-2-columns/)
 * For the last days I tried to get a loop over 2 columns. All the tutorials I’ve
   have find do provide a loop code but none of theme work with paged pages.
 * I have a left column that have to show 5 posts (from a certain category) and 
   a right column that have to show the next 5 posts. I do not want to css split
   the posts but want a multiple loop that works with paged pages. So the next paged
   have to show the next 10 (5×5) post etc. etc.
 * Does anyone have a idea? I really appreciate your comment.

Viewing 1 replies (of 1 total)

 *  Thread Starter [jobmeer](https://wordpress.org/support/users/jobmeer/)
 * (@jobmeer)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/paged-loop-over-2-columns/#post-1790943)
 * I have create a code that allow 2 loops and not duplicate the posts, but it is
   still not working for the next page (`$paged`). Here the code:
 *     ```
       <?php get_header(); ?>
       <?php get_sidebar(); ?>
   
       	<?php /* Left Column
       -------------------------------------------------------------------*/?>
       	<div id="left-column">
   
       	<?php if (have_posts()) :
       	$count = 0;
       	$saved_ids = array();
       	while (have_posts()) : the_post(); ?>
       	<?php $count++; ?>
       	<?php $saved_ids[] = get_the_ID(); ?>
   
       	<?php if ($count <= 5) : {
        	$saved_ids[] = get_the_ID();?>
   
       	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
       	<?php the_excerpt(); ?>
   
       	<?php } endif; // End if ?>
       	<?php endwhile; 
   
       	else: ?>
       	<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       	<?php endif; ?> 
   
        	<?php posts_nav_link(); ?>
   
       	</div>
   
       <?php /* Right Column
       -------------------------------------------------------------------*/?>
       	<div id="right-column">
   
       	<?php if (have_posts()) :
       	query_posts(array(
       	'post__not_in' => $saved_ids,
       	));
   
       	while (have_posts()) : the_post(); ?>
   
       	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
       	<?php the_excerpt(); ?>
   
       	<?php endwhile; 
   
       	else: ?>
       	<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       	<?php endif; ?> 
   
       	</div> 
   
       <?php get_footer(); ?>
       ```
   
 * Does anyone have a idea how to fixed the paged problem in this code?

Viewing 1 replies (of 1 total)

The topic ‘Paged loop over 2 columns’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [jobmeer](https://wordpress.org/support/users/jobmeer/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/paged-loop-over-2-columns/#post-1790943)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
