get understrap pagination to work with custom query

the pagination function does nothing with a custom loop That’s because for custom loops or secondary WP_Query instances like your $catquery variable, you need to explicitly tell the function how many pages are available for your custom query. So the $total argument (see the function’s description) should be set to the max_num_pages property of the … Read more

Customize “the_posts_pagination” and put list instead div

Making your Custom Pagination design In Demo According Your Need . below function Replace Your Function: function wp_custom_pagination($args = [], $class=”pagination”) { if ($GLOBALS[‘wp_query’]->max_num_pages <= 1) return; $args = wp_parse_args( $args, [ ‘mid_size’ => 2, ‘prev_next’ => false, ‘prev_text’ => __(‘Previous’, ‘textdomain’), ‘next_text’ => __(‘Next’, ‘textdomain’), ‘screen_reader_text’ => __(‘Posts navigation’, ‘textdomain’), ]); $links = paginate_links($args); … Read more

Pagination doesn’t work in custom page template [duplicate]

Try the following and see how you go.. <?php global $paged; global $wp_query; $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query(‘posts_per_page=10&post_type=your_post_type’.’&paged=’.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <!– do your loop output here, title, content etc –> <?php endwhile; ?> <?php previous_posts_link(‘&laquo; Newer’) ?> <?php next_posts_link(‘Older &raquo;’) ?> <?php $wp_query = null; $wp_query … Read more

Different amount of posts on homepage than paged pages

You should use the pre_get_posts filter. You can exclude the homepage with ! is_front_page or ! is_home depending on your configuration. /** * Changes the number of posts per page if not is_home * * @author SFNdesign, Curtis McHale */ function wptt_change_posts_on_page( $query ) { if ( ! is_home() && $query->is_main_query() ) { $query->set( ‘posts_per_page’, … Read more

How to no follow the paginated comments

There are two special filters for that: add_filter( ‘previous_comments_link_attributes’, ‘wpse_77217_comment_nofollow’ ); add_filter( ‘next_comments_link_attributes’, ‘wpse_77217_comment_nofollow’ ); function wpse_77217_comment_nofollow() { return ‘ rel=”nofollow”‘; }

Pagination with custom post types results in 404 issues

By the time you reach the template, WordPress has already queried the database and decided what to display based on those results. You’re seeing a 404 error because based on the default main query, there are no more posts to show. When you call query_posts in the template, you overwrite that original query. Despite the … Read more

Jetpack Infinite scroll conflicting with theme’s pre_get_posts custom posts_per_page

You’ve specified a priority of 1 for your pre_get_posts function here: add_action( ‘pre_get_posts’, ‘mytheme_portfolio_archive_pages’, 1 ); Jetpack doesn’t specify a priority: add_action( ‘pre_get_posts’, array( $this, ‘posts_per_page_query’ ) ); So that gets added with the default priority for add_action, which is 10: $priority (int) (optional) Used to specify the order in which the functions associated with … Read more