Custom Post Type shows pagination (w/404) or posts_per_page query, but not both

user5477769 reports in the comments of the original post, that the problem has been solved: I was following Custom Post Type UI instructions but it seems it led me astray. Creating a archive-gallery.php with a vanilla Loop, along with removing is_main_query has solved all problems, and the pages now show with 9 posts and correct … Read more

the_posts_navigation is not working

This function uses get_the_posts_pagination() which uses the GLOBAL $wp_query to setup the paginate_links() function, so I believe that doesn’t work for get_posts. Try use the function paginate_links() by itself or the function posts_nav_link()

Pagination doesn’t work on static front page

Use https://codex.wordpress.org/Pagination#static_front_page And https://codex.wordpress.org/Creating_a_Static_Front_Page Other solutions https://stackoverflow.com/questions/20644991/wordpress-static-page-pagination the query is diferent on static front pages … one hack after of your while <?php if ($the_query->max_num_pages > 1) : // custom pagination ?> <?php $orig_query = $wp_query; // fix for pagination to work $wp_query = $the_query; echo ‘<div class=”both”></div>’; understrap_pagination(); //your pagination $wp_query = $orig_query; // … Read more

Pagination returns 404 after page 20

What you are experiencing is quite normal and expected. This is one of the big reasons I always hammer on this point, never use custom queries to replace the main query on the home page or any type of archive page. They solve one issue but creates plenty other new ones Lets look at what … Read more

Alternative layout the loop

For those interested, i’ve solved my problem using sizeof($wp-query->posts) The end-result is this content-news.php template <?php //echo sizeof($wp_query->posts); //var_dump($wp_query);die(); if(sizeof($wp_query->posts) == 4) : ?> <?php if( $wp_query->current_post == 0 ) : ?> <h3><?php the_title(); ?></h3> <div class=”row”> <div class=”col-md-12″> <p><?php the_excerpt(); ?></p> <p><a href=”https://wordpress.stackexchange.com/questions/216989/<?php the_permalink(); ?>” class=”btn btn-primary btn-sm”>Lees Meer</a></p> </div> </div> <div class=”fh5co-spacer fh5co-spacer-sm”></div> … Read more

Pagination For Page Post Type

Actually, I think you don’t need too much like above on this For example, a loop you use to retrieve pages, $args = array( ‘posts_per_page’ => 5, ‘post_type’ => ‘page’, ‘paged’ => $paged, ); $the_query = new WP_Query( $args ); ?> <!– the loop etc.. –> Then get the paginate links <?php $big = 999999999; … Read more

Pagination in WP_Query?

Put the following code in functions.php # +++++++++++++++++++++++++++++++Pagination ++++++++++++++++++++++++++++++++++++++ function kriesi_pagination($pages=””, $range = 2) { $prev = __(‘« Prev’); $next = __(‘Next »’); $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == ”) { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)