• drskjelde

    (@drskjelde)


    Hi guys,

    I have implemented Isotope in a Adaptive Flat Child theme. Isotope is working great but now all the pages shows the latest 20 posts.. (I have many blog posts, showing 20 on each page.

    How can I add pagination to this custom loop? E.g. on page 2 I want posts 21-41 to show etc.

    <?php $the_query = new WP_Query( 'posts_per_page=20'); //Check the WP_Query docs to see how you can limit which posts to display ?>
    
    <?php if ( $the_query->have_posts() ) : ?>
    
        <div id="isotope-list">
    
        <?php while ( $the_query->have_posts() ) : $the_query->the_post(); 
    
    	$termsArray = get_the_terms( $post->ID, "category" );  //Get thevterms for this particular item
    	$termsString = ""; //initialize the string that will contain the terms
    		foreach ( $termsArray as $term ) { // for each term
    			$termsString .= $term->slug.' '; //create a string that has all the slugs
    		}
    	?> 
    
    	<div class="<?php echo $termsString; ?> item">
    
    							<article  <?php post_class('post-prev clearfix');?>>
    
    								<?php adaptive_flat_thumbnail(480, 300); 
    
    									the_post_thumbnail();
    								?>											
    
    								<h2 class="prev-title"><a href="<?php the_permalink() ?>"><?php the_title();?></a></h2>
    
    								<div class="meta-tags">
    								<?php	do_action( 'adaptive_flat_post_meta' );
    								wp_link_pages();?>
    								</div>	
    
    								<?php adaptive_flat_excerpt() ?>
    
    							</article>
    
    	</div> <!-- end item -->
        <?php endwhile;  ?>
        </div> <!-- end isotope-list -->
    <?php endif; ?>

    Isotope is integrated in this way: https://www.aliciaramirez.com/2014/03/integrating-isotope-with-wordpress/

    Appreciate all help

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add Pagination to custom Wp_Query with Isotope filtering’ is closed to new replies.