Pagination for custom post type not working [duplicate]
I believe if posts_per_page is set to -1 you’re showing all posts without pagination. Try setting it to 5 for example.
I believe if posts_per_page is set to -1 you’re showing all posts without pagination. Try setting it to 5 for example.
This works: mysite.com/sermon/term/childterm/page2/ This does not: mysite.com/sermon/term/childterm/page2/ according to your rewrite rule, I guess what you mean is This works: mysite.com/sermon/term/page2/ This does not: mysite.com/sermon/term/childterm/page2/ I’m not a regex expert so I only come up with adding another rewrite rule to handle the childterm situaion add_rewrite_rule( ‘sermon/(.*?)/(.*?)/page/?([0-9]{1,})/?$’, ‘index.php?post_type=”.$cpt.”&’.$tax.’=$matches[2]&paged=$matches[3]’, ‘top’ );
Pagination work! But title still says “Page Not Found”
This works for me with no 404s <?php $args = array ( ‘posts_per_page’ => 5 , ‘paged’ => $paged, ‘ignore_sticky_posts’ => true ); $blog_query = new WP_Query($args); if ( $blog_query->max_num_pages > 1 ) { next_posts_link(‘← Older posts’, $blog_query->max_num_pages); previous_posts_link(‘Newer posts →’, $blog_query->max_num_pages); } while ( $blog_query->have_posts() ) { $blog_query->the_post(); // STUFF } if ( $blog_query->max_num_pages … Read more
Get Previous/Next Post ID for Posts in Same Category
Alter the main query for the front/home page with is_front_page() and/or is_home(), like shown below: add_action(‘pre_get_posts’,’wpse104878_alter_main_query’); function wpse104878_alter_main_query($query){ if ( is_admin() || ! $query->is_main_query() ) { return; } if( $query->is_main_query() && is_front_page() || is_home() ){ $query->query_vars[‘posts_per_page’] = ‘1’; } } The archive page should work, if underscore starter theme has an template for it. You … Read more
Paginate template name
In your function, you can use $_GET and do all the validation you want to: You can look if it’s greater than 0 if it’s a string or an integer And then use wp_redirect to go the error page or whatever page you want.
Infinite scroll repeats posts in custom loop in single.php
I believe what you need is is_page(). if (is_paged()) { // page 2 or later of an archive } else { // only the first page of an archive } With your code, I think but am not 100% sure, that you want: if( !is_paged() && ( is_home() || is_front_page() ) ) : get_template_part( ‘hero’ … Read more