WordPress.org

Forums

WP-PageNavi
Current page are wrong using $wpdb->get_results( (2 posts)

  1. fedenuche
    Member
    Posted 3 years ago #

    Hi, Im using somenting like

    $pagina 	= (int) $paged;
    $pagina 	= $pagina-1;
    $comienzo 	= ($posts_page * $pagina);
    $limit 		= "LIMIT ".$comienzo.",".$posts_page;
    
    $slq = "SELECT * FROM...";
    $totalposts = $wpdb->get_results($sql, OBJECT);
    $wp_query->found_posts = count($totalposts);
    $wp_query->max_num_pages = ceil($wp_query->found_posts / $posts_page);
    
    $wp_query->request = $sql.$limit;
    
    $pageposts_evts = $wpdb->get_results($wp_query->request, OBJECT);
    
    ...
    
    wp_pagenavi();

    If I click on the 2 page or 3 I can see the correct content but the selected (current) is always the 1. I read this http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html and thry to use .

    wp_pagenavi( array( 'query' => $wp_query ) );
    
    wp_reset_postdata();	// avoid errors further down the page

    But it not working.

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

  2. donboy7
    Member
    Posted 2 years ago #

    I am having same problem..

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic