• Resolved ncox85

    (@ncox85)


    I know this is a common problem, but I am not familiar enough with PHP to adapt any of the many examples to fit my custom loop. I have sorted my loop to display one category called Classes. I am also sorting posts by date using custom fields. But the pagination shows the same posts on each page. I know the query_posts is what is breaking it, but I don’t know how to fix it.

    Here is my loop code:

    <?php if ( have_posts() ) : ?>
    
    	<?php
    	$todaysDate = date('m/d/Y H:i:s');?>
    
    <?php query_posts('showposts=5&category_name=classes&meta_key=Date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    	<?php
    	get_template_part( 'content-home', get_post_format() );
    		?>
    
    	<?php endwhile; ?>
    
    	<?php _s_paging_nav(); ?>
    
    	<?php else : ?>
    
    	<?php get_template_part( 'content', 'none' ); ?>
    
    	<?php endif; ?>
Viewing 16 replies (of 16 total)
  • No problem, glad that I was able to help out. Sorry it took a bit of back and forth.

    Best of luck with the site ncox85, hopefully things will be smooth from here on out!

    Evan

Viewing 16 replies (of 16 total)
  • The topic ‘Pagination problem – displays the same posts on each page’ is closed to new replies.