Support

Account

Forum Replies Created

  • Hi! I tried adding the navigation links using pagenavi and found something interesting: even though I have enough posts to create two archive pages, WordPress is only pulling the first. Theoretically I could have more than the 9 posts per page in the query, but WP would still not show the pagination for the pages after the first.

    How could I fix this?

  • Thanks so much for your help! In the end I was able to do it by calling the default date and permalinks instead of adding a separate custom field for those.

    The result can be seen at http://nerdfit.com/videos

    The only problem I have now is that I can’t get pagination going with this custom post type archive. Is there any way I can show the “older entries” and “newer entries” links at the bottom of the loop?

    This is my code so far:

    <div class="wrap">
    
    	<?php 
    
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;		
    
    	$args = array( 
    		'post_type' => 'video',
    		'paged' => $paged,
    		'posts_per_page' => 9);
    
    	$query = new WP_Query( $args ); ?>
    
    	<?php if ( $query->have_posts()) : while ( $query->have_posts() ) : $query->the_post(); ?>
    
    			<div class="video-item">
    				<div class="video-image">	
    						<a href="<?php echo get_permalink(); ?>" ><?php the_post_thumbnail(); ?></a>
    
    				</div>
    			<h2><a href ="<?php echo get_permalink(); ?>" ><?php the_title(); ?></a></h2>
    			<h3><?php echo get_the_date(); ?></h3>
    
    			</div>
    		
    	<?php endwhile; ?>
    
    <?php
    
    // get_next_posts_link() usage with max_num_pages
    echo get_next_posts_link( 'Older Entries', $the_query->max_num_pages );
    echo get_previous_posts_link( 'Newer Entries' );
    ?>
    
    <?php 
    // clean up after the query and pagination
    wp_reset_postdata(); 
    ?>	
    
    <?php else: ?>
    
    	<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    
    	<?php endif; ?>
    
    </div>
    
    </section>
Viewing 2 posts - 1 through 2 (of 2 total)