Tag Info

Hot answers tagged

7

// get current page we are on. If not set we can assume we are on page 1. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // are we on page one? if(1 == $paged) { //true }


5

if you only want to know that you are on the first page of a paginated page, try: if( !is_paged() ) { //first page of pagination } http://codex.wordpress.org/Function_Reference/is_paged


5

wp_pagenavi( array( 'query' => $loop ) ); should work with the code above. Don't hijack the main query if you can avoid it.


4

You can try implementing ajax based pagination for wp-pagenavi plugin(see http://wordpressapi.com/2011/05/16/add-ajax-pagination-in-wordpress-blog/ for reference ). I think this will solve your issue.


3

I was looking for a simple way to determine whether or not to use the posts_nav_link() function and all solutions I found online were either too complex or unreliable. For example, many people suggested using the $paged global variable, but I found that this variable returned the same value for the first page, even when the first page was the only page! So, ...


3

Take a look at this tutorial: http://www.wpmods.com/easily-ajax-wordpress-pagination


2

Replace 'page' with 'paged': 'paged' => get_query_var('paged'),


2

As pointed out by @t31os in the comments, get_query_var('page') should actually be get_query_var('paged').


2

Use sessions: <?php session_start(); if( isset( $_POST['order'] ){ $order = filter_input( INPUT_POST, 'order', FILTER_SANITIZE_STRING ); if( $order ) $_SESSION['order'] = $order; } if( isset( $_SESSION['order'] ) $order = $_SESSION['order'];


1

Here are the solutions I found (note I'm using WP 3.3.2 and WP-Pagenavi 2.82): Solution 1: Using paged instead of page as a get_query_var parameter. Solution 2 Using ajax based navigation, just as in the article swtshweta pointed out. (using Ajax, pagination works properly even with the page parameter).


1

You're initially submitting a POST request via a form with the sort parameters. When you click links to additional pages, you're just sending a GET request for the next page without those original POST vars, so they don't carry over to the additional pages and aren't picked up by your if(isset($_REQUEST['sort'])). Probably the simpler way to handle it is to ...


1

Because this comes up in search, I'd like to point out that WP Page Navi ( as of version 2.74 ) now supports custom queries. The WP_Pagenavi FAQ links to the following article to explain how to use the Pagenavi plugin with a secondary query by passing the wp_pagenavi() function a query parameter. From the tutorial: $my_query = new WP_Query(); while ( ...


1

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. $paged = get_query_var( ...


1

If you're using the WP-PageNavi plugin, there are several FAQs on using it with a secondary query loop: http://wordpress.org/plugins/wp-pagenavi/faq/ this code is from one of the pages linked from that FAQ: $my_query = new WP_Query( array( 'tag' => 'foo', 'paged' => get_query_var('paged') ) ); while ( $my_query->have_posts() ) : ...


1

Add the next lines of code to functions.php file within active theme to start session. function example_login() { if ( ! session_id()) { session_start(); } } add_action( 'init', 'example_login' ); and then Use $_SESSION to store the value of $post


1

Why do you dont use the default functions from WP. As example the follow class, there you can use. class fb_pagination_example { public function content_nav( $nav_id, $pag_bar = TRUE ) { if ( $GLOBALS['wp_query'] -> max_num_pages > 1 ) : ?> <nav id="<?php echo $nav_id; ?>"> <h1 ...


1

I solved this by changing the urls... seems such a stupid mistake now! I had the same url for the page as the taxonomy and they were clashing. As soon as I renamed the page url the pagination worked.


1

I took a look at the index.php code and I'll explain what's going on. The theme author is using 2 custom new WP_Queries but is not doing anything with the main global $wp_query object. When you click to the second page you get the same posts because there is no main loop present. Neither of the secondary loops contain pagination parameters. To fix this ...


1

You have syntax error in query arguments: 'orderyby'.


1

If you take a look at the line below, you will find that there is an extra "y" in the 'orderby' parameter. Removing that should fix it. 'orderyby' => 'meta_value_num date', // note: I also tried with meta_value


1

I've had this issue, mine fixed itself when I renamed the page (my page name was the same as my custom post name)


1

Why are you using a category link built with a question mark? If you use the correct permalink which is http://renegadehealth.com/blog/herbs pagination is working fine.


1

Probably the problem has been already solved here: http://stackoverflow.com/a/13216165/1801379 You ca also get some idea from here: http://wordpress.stackexchange.com/a/4131/23290


1

you are quering the same posts over and over, and that is way you are getting the same posts, to fix it just add 'paged' => get_query_var('paged') to your query arguments, so change: <?php $portfolioloop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => 12 ) ); ?> into: <?php $portfolioloop = new WP_Query( array( ...


1

try to do the following in /layouts/default.php (and /layouts/blog.php): change the query line (line 5) to: wp_reset_query(); $paged = (get_query_var('paged')) ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1 ); $the_query = new WP_Query('cat=-'. $GLOBALS[ex_feat] . ',-' . $GLOBALS[ex_vid] . '&showposts=' . ...


1

This could be a plugin compatibility problem. Have you tried to disable all plugins and see if that solves the problem? I found this which may also be of help: http://dre.im/if-pages-return-a-404-after-wordpress-3-1-upgrade/ Log in to wp-admin and go to permalinks, click save (this should refresh your permalinks). Check to see if this fixes your ...


1

Looks like Old Famous Problem with paged try this for quey_posts(); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array( 'posts_per_page' => 8, 'paged' => $paged ) );


1

You need to do a little "hack" to get pagination to work for your custom loop. After you define $loop, do the following: <?php // globalize $wp_query global $wp_query; // copy $wp_query into a temporary variable $temp_wp_query = $wp_query; // nullify $wp_query $wp_query = null; // move $loop into $wp_query $wp_query = $loop; ?> At this point, your ...



Only top voted, non community-wiki answers of a minimum length are eligible