Pagination not working with custom loop

I’ve run into this problem with PageNavi before. My solution is to hijack the $wp_query variable temporarily and then reassign it after closing the loop. An exmaple: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args=array( ‘post_type’=>’post’, ‘cat’ => 6, ‘posts_per_page’ => 5, ‘paged’=>$paged ); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query($args); /* … Read more

Pagination URL order

Well this seems to fix it. Not sure if this is the best way to do it so please enlighten me if I’m wrong: By changing: if ( $wp_rewrite->using_permalinks() ) $pagination[‘base’] = user_trailingslashit( trailingslashit( remove_query_arg( ‘s’, get_pagenum_link( 1 ) ) ) . ‘page/%#%/’, ‘paged’ ); to: if ( $wp_rewrite->using_permalinks() ) $_SERVER[‘REQUEST_URI’] = user_trailingslashit( trailingslashit( remove_query_arg( … Read more

Wp Pagenavi how to display all results

I replaced it with: $out .= $instance->get_single( 1, ‘first’, “All”, 100, 1 ); And I changed the get_single function, more exactly I added a parameter, “all”, and this one won’t afect anything else. function get_single( $page, $class, $raw_text, $format=”%PAGE_NUMBER%”, $all = 0 ) { if ( empty( $raw_text ) ) return ”; $text = str_replace( … Read more

Pagination With Custom WP Query not functioning

One issue at least: you’ll want to close the loop before outputting your pagination links, or else they’ll be output on every iteration of the loop. But you’ve got paginate_links() before endwhile;. Try this arrangement instead: // open loop if ( have_posts() ) : while ( have_posts() ) : the_post(); // Loop markup // close … Read more

pagenavi shows a lot of pages calculated from all posts in the site with query_posts

I didn’t load the plugin to check and I never use query_posts(), but perhaps tie_pagenavi() is depending on the value in the $paged global variable. Try adjusting that value before (or after) calling query_posts(). Here is the code to adjust it before calling query_posts(). if ( get_query_var( ‘paged’ ) ) // On a paged page. … Read more

Pagination on Custom Loop

function dot1_get_nav(){ if ( get_next_posts_link() || get_previous_posts_link() ) { ?> <nav class=”dot1-navigation clearfix”> <?php if ( get_next_posts_link() ) { ?> <div class=”alignleft”> <?php next_posts_link( __( ‘&larr; Older Entries’, ‘dot1’ ) ); ?> </div> <?php } ?> <?php if ( get_previous_posts_link() ) { ?> <div class=”alignright”> <?php previous_posts_link( __( ‘Newer Entries &rarr;’, ‘dot1’ ) ); ?> … Read more

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