Can't get this to work on a custom post type
-
First let me say after trying multiple ajax loading plugins, I like how this one works the most. However, I can only get it to work on my index.php, taxonomy pages, archives, etc. For the life of me, I can’t get this to work if it’s on a template that’s calling a custom post type. Without the plugin, I can get pagination working no problem – I just can’t get it to replace the pagination with the load more button.
My loop on this page:
<?php $args = array ('post_type' => 'portfolio', 'paged'=>$paged); $wp_query = new WP_Query ( $args ); ?> <?php if ( have_posts() ) : ?> <div class="grid_size col-xs-6 col-sm-3"></div> <?php /* Start the Loop */ ?> <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <?php get_template_part( 'template-parts/content', 'project_list' ); ?> <?php endwhile; ?> <?php the_posts_pagination( array( 'prev_text' => __( 'Previous page', 'benoit_2015' ), 'next_text' => __( 'Next page', 'benoit_2015' ), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'benoit_2015' ) . ' </span>', ) ); ?> <?php else : ?> <?php get_template_part( 'template-parts/content', 'none' ); ?> <?php endif; ?> <?php wp_reset_postdata(); ?>
Any help would be appreciated.
-Nick
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Can't get this to work on a custom post type’ is closed to new replies.