Support » Fixing WordPress » Multiple Loops pagination problem with custom permalinks

  • Good morning everybody,

    I have run into a problem which is quite strange. I have setup a personal theme with a single.php, where I use multiple loops – one loop for displaying the actual post – with pagination back and forward – and one loop for displaying all posts in this category – with pagination back and forward (which will change the listing of all posts).

    The problem is with the second loop (all posts in current category):
    It works fine when I’m using the standard permalink option like:

    When it comes to pagination WordPress adds “&paged=2” at the end of the URL

    and changes the content of the second loop. Good.
    If I switch to custom permalinks using “/%category%/%postname%/” for example:

    the pagination of the second loop doesn’t change the URL to
    and does not change the content. Bad.

    Any idea, why it works with standard permalinks but not with custom permalinks? Could it be a WordPress bug?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This is the code:

    # get_sidebar();
    			$category_id = get_the_category();
        		$category_link = get_category_link( $category_id[0]->cat_ID );
    			$category = $category_id[0]->cat_ID;
              <div id="ContentFrame">
    		  <!-- Single.php -->
          		<?php global $query_string;
    			query_posts( $query_string . "&cat=$category&showposts=1" ); ?>
    			<?php while (have_posts()) : the_post(); $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 800,9999 ), false ); ?>
               <div class="stage">
    		   <div id="Close">
                   <a href="<?php echo $category_link; ?>" title="Zur&uuml;ck zur Rubrik"><img src="<?php bloginfo('template_url'); ?>/images/close-x.jpg" width="25" alt="Close"/></a>
    		   <center><?php echo wpop_image_display(); ?></center>
               </div> <!-- end .stage -->
    			<?php endwhile; ?>
    		   <div class="navigation">
    				<div class="nav_alignright">
    				<?php previous_post_link('%link','&raquo;&raquo;', TRUE); ?>
    				<div class="nav_alignleft">
    				<?php next_post_link('%link','&laquo;&laquo;', TRUE); ?>
    		$cat = $category;
    		$post_per_page = 8; // -1 shows all posts
      		$do_not_show_stickies = 1; // 0 to show stickies
        		'category__in' => array($cat),
        		'orderby' => 'date',
        		'order' => 'DESC',
        		'paged' => $paged,
        		'posts_per_page' => $post_per_page,
        		'caller_get_posts' => $do_not_show_stickies
      		$temp = $wp_query;  // assign orginal query to temp variable for later use
      		$wp_query = null;
      		$wp_query = new WP_Query($args);
    		<div id="ImageSelection">
            <ul id="ImgRow">
            <?php // echo $paged; ?>
    		<?php if( have_posts() ) :
    			while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
        		<li><a href="<?php echo the_permalink(); ?>"><?php echo get_the_post_thumbnail($post->ID, 'thumbnail'); ?></a></li>
    		<?php endwhile;  ?>
              </div> <!-- end of ImageSelection -->
              	<div class="ImgNavi">
          			<div class="ImgNaviLeft"><?php previous_posts_link('&laquo;&laquo;') ?></div>
    				<div class="ImgNaviRight"><?php next_posts_link('&raquo;&raquo;') ?></div>
    		<?php else : ?>
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php endif; ?>
    		</div> <!-- end of ContenFrame -->				
    <?php get_footer(); ?>

    It seams, that WordPress has a problem with pagination of two different loops when it comes to custom permalinks…. Any hints so far?

    Good morning again,
    I think today is the perfect day to be helped out here in the forum by somebody.


    I think, this topic is it worth, to bring it on top of the cue again. If anybody has a solution for this…… that would be really great.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple Loops pagination problem with custom permalinks’ is closed to new replies.