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?