Custom post pagination inside
-
Inside default category.php I have a sidebar with custom post types. I need to add pagination in order to enable infinite scroll. I tried at least 3 different snippets from the web and none did the job. Maximum result I get is the link to the page 2 of the current category.
My code is below, site – https://www.jcvergara.com/category/videos-audios/. Thanks for any suggestions.
<?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=2&post_type=external_article'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <div class="item <?php echo $tag_list; ?>"> <div class="item-title"> <h4><?php the_title(); ?><br/>Article on other sites</h4> </div> <div class="item-img"> <a href="<?php echo get_post_meta( get_the_ID(), 'link_to_the_article', true ); ?>" target="_blank"> <?php $image_ext = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <div class="thumb" style="background-image: url('<?php echo $image_ext[0]; ?>'); "></div> </a> </div> </div> <?php endwhile; ?> <nav id="ext-page-nav"> <?php next_posts_link('Older »') ?> </nav> <?php $wp_query = null; $wp_query = $temp; // Reset ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom post pagination inside’ is closed to new replies.