Support » Plugin: WP-PageNavi » Use with WP_Query (not query_posts)

  • Resolved alxvallejo

    (@alxvallejo)


    When I go to page 2, I see the same posts as on page 1!
    You’re using query_posts() wrong. See The Right Way To use query_posts()

    I’ve read in a multitude of places that query_posts should be used as a last resort. It generally is a shorter way of constructing a new Loop (new WP_Query).

    So, why does the FAQ insist that query_posts should be used?

    Also, does anyone know why my styles are being queued when I use wp_pagenavi in the admin section?

    http://wordpress.org/extend/plugins/wp-pagenavi/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter alxvallejo

    (@alxvallejo)

    Styles issue resolved:

    add_action( 'admin_enqueue_scripts', array( __CLASS__, 'stylesheets' ) );

    Added to core.php, Line 273

    Plugin Author scribu

    (@scribu)

    So, why does the FAQ insist that query_posts should be used?

    Because people forget to pass the query instance to wp_pagenavi() and then come here and say the plugin is broken.

    Correct usage:

    $my_query = new WP_Query( ... );
    
    wp_pagenavi( array( 'query' => $my_query ) );
    Thread Starter alxvallejo

    (@alxvallejo)

    Thanks scribu. Have you been able to use wp_pagenavi on the admin side? I’ve heard that the paged variable for the query doesn’t register on the admin side – could be wrong though.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Use with WP_Query (not query_posts)’ is closed to new replies.