WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Pagination and loops help? (1 post)

  1. adamccc
    Member
    Posted 2 years ago #

    Hi there,

    I've been trying to come up with multiple loops for my site with displays posts as such -

    1 post
    2 posts
    4 posts
    3 posts
    3 posts

    You can see it here http://hushtv.co.uk

    To work with the redesign of our website. I've managed to achieve this following this blog (http://perishablepress.com/multiple-loops-and-multiple-columns-with-wordpress/) but as I'm sure you'll guess pagination doesn't work using this method

    After lots of searching I managed to find this post that looks like someone got it to work http://wordpress.org/support/topic/paging-with-multiple-loops-in-index

    But all the code that was used was in pastebin and has now expired :( can Mark / t31os or anyone provide some help?

    <div class="top_story">
    	<?php _posts('showposts=1'); ?>
    	<?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?>
    	<?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>
            <header class="entry-header">
    		<?php $youtubeid = get_post_meta($post->ID, "youtubeid", true); ?>
    		<?php if($youtubeid !== '') { ?>
    			<iframe width="747" height="419" src="http://www.youtube.com/embed/<?php echo $youtubeid; ?>" frameborder="0" allowfullscreen></iframe>
    		<?php } ?>
    		<?php if($youtubeid == '') { ?>
    			<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if ( has_post_thumbnail() ) {
    			the_post_thumbnail(747,419);
    		} ?><a/>
    		<?php } ?>
    		<?php $cat = get_the_category(); ?>
    <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h3 class="<?php echo $cat[0]->slug;?>"><?php the_title(); ?></h3></a>
    <?php unset($cat); ?>
    		</header><!-- .entry-header -->
    	<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    			<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    			<?php $count1++; } ?>
    			<?php endforeach; ?>
    		</div>
    		<div class="linebreak"></div>
    
    				<div class="row-fluid">
    				<?php get_posts('showposts=2'); ?>
    				<?php $posts = get_posts('numberposts=2&offset=1'); foreach ($posts as $post) : start_wp(); ?>
    				<?php static $count2 = 0; if ($count2 == "2") { break; } else { ?>
    <div class="span6 split_story">
    			<header class="entry-header">
    
    			<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail(747,419);
    } ?><a/>
    
    			<?php $cat = get_the_category(); ?>
    <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h3 class="<?php echo $cat[0]->slug;?>"><?php the_title(); ?></h3></a>
    <?php unset($cat); ?>
    		</header><!-- .entry-header -->
    
    		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    			<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    		</div>
    				<?php $count2++; } ?>
    				<?php endforeach; ?>
    
    						<div class="linebreak"></div>
    					</div>
    
    				<?php query_posts('showposts=4'); ?>
    				<?php $posts = get_posts('numberposts=4&offset=3'); foreach ($posts as $post) : start_wp(); ?>
    				<?php static $count3 = 0; if ($count3 == "4") { break; } else { ?>
    
    <div class="row-fluid row_story">
    
    						<div class="span4">
    			<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail(747,419);
    } ?><a/>
    						</div>
    						<div class="span8">
    								<header class="entry-header">
    			<?php $cat = get_the_category(); ?>
    <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h3 class="<?php echo $cat[0]->slug;?>"><?php the_title(); ?></h3></a>
    <?php unset($cat); ?>
    
    		</header><!-- .entry-header -->
    
    		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    			<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    						</div>
    						<div class="linebreak"></div>
    					</div>
    
    						<?php $count3++; } ?>
    				<?php endforeach; ?>
    
    					<div class="row-fluid triple_story">
    
    				<?php query_posts('showposts=3'); ?>
    				<?php $posts = get_posts('numberposts=3&offset=7'); foreach ($posts as $post) : start_wp(); ?>
    				<?php static $count3 = 0; if ($count4 == "3") { break; } else { ?>
    
    						<div class="span4">
    
    								<header class="entry-header">
    
    			<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail(747,419);
    } ?><a/>
    
    			<?php $cat = get_the_category(); ?>
    <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h3 class="<?php echo $cat[0]->slug;?>"><?php the_title(); ?></h3></a>
    <?php unset($cat); ?>
    
    		</header><!-- .entry-header -->
    
    		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    			<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    
    						</div>
    
    				<?php $count4++; } ?>
    				<?php endforeach; ?>
    					<div class="linebreak"></div>
    
    					<div class="row-fluid triple_story">
    
    				<?php query_posts('showposts=3'); ?>
    				<?php $posts = get_posts('numberposts=3&offset=10'); foreach ($posts as $post) : start_wp(); ?>
    				<?php static $count3 = 0; if ($count5 == "3") { break; } else { ?>
    
    						<div class="span4">
    
    								<header class="entry-header">
    
    			<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail(747,419);
    } ?><a/>
    
    			<?php $cat = get_the_category(); ?>
    <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h3 class="<?php echo $cat[0]->slug;?>"><?php the_title(); ?></h3></a>
    <?php unset($cat); ?>
    		</header><!-- .entry-header -->
    
    		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    			<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    
    						</div>
    
    				<?php $count5++; } ?>
    				<?php endforeach; ?>
    
     	</div>

    Thanks

    [duplicate post: http://wordpress.org/support/topic/pagination-with-multiple-loops ]

Topic Closed

This topic has been closed to new replies.

About this Topic