Pagination with WP_Query not working
Pagination with WP_Query not working
Pagination with WP_Query not working
The Problem By default, in any given context, WordPress uses the main query to determine pagination. The main query object is stored in the $wp_query global, which is also used to output the main query loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); When you use a custom query, you create … Read more
Two problems I can see off hand here Firstly, you should move your query to outside your if conditional statement. Secondly, when using WP_Query, the $max_pages parameter should be used when using next_posts_link( $label , $max_pages ); So, your code should look something like this <div class=”wrapper inner_content_wrap”> <?php next_posts_link( ‘<span class=”label iconfont”><img src=”‘.get_template_directory_uri().’/images/pager_arw.png” alt=””></span><span … Read more
I would do something like this: <?php //Protect against arbitrary paged values $paged = ( get_query_var( ‘paged’ ) ) ? absint( get_query_var( ‘paged’ ) ) : 1; $args = array( ‘posts_per_page’ => 6, ‘category_name’ => ‘case-study’, ‘paged’ => $paged, ‘show_all’ => False, ‘prev_next’ => True ); $the_query = new WP_Query( $args ); ?> <?php if … Read more
Transfering static site to wordpress and retaining category by month paginations
I am answering my own question. Here is the javascript that I wrote which works 100% smooth. <script> $(document).on(“scroll mousedown DOMMouseScroll mousewheel keydown”, function (e) { if (e.which > 0 || e.type === “mousedown” || e.type === “mousewheel”) { $(‘html,body’).stop(); } }); pageSize = 1; showPage = function(page) { $(“.comix”).hide(); $(“.comix”).each(function(n) { if (n >= … Read more
You should be able to exclude the category you don’t want to show by adding $excluded_terms to your navigation links. So for example, if the category you don’t want showing up is id 4 your link would look like: <?php next_post_link( ‘%link’, ‘Next Post’, false, ‘4’ );?> Same with previous_post_link().
Excluding certain post status’s from pagination
The get_query_var() function is looking at the main query for the page, which you are not actually using here. You’re using a custom query. So, try looking at what is in $result instead.
pagination broken because wordpress is adding index.html