Support » Plugin: WP-PageNavi » [Plugin: WP-PageNavi] is this possible? random posts while paged

  • Hi there,

    i`m building a gallery with a few houndred artworks (custom posts) and I wonder if I can have them displayed randomly and paged at the same time.

    With the following code when each page reloads the posts change possitions and some reappear in multiple pages.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array('post_type' => 'artworks', 'orderby'=>rand, 'paged'=>$paged, 'posts_per_page' => 60);

    Is it possible to first randomise their possition and then divide them into pages (but to keep their possition for current session)?

    Can this be done with wp-pagenavi? Any ideas?

Viewing 1 replies (of 1 total)
  • to share my own experience, i can tell you that I have tested the same approach on one of my websites where i need to randomly display some posts.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $arg = array (   'cat'=>133,
    $wp_query = new WP_Query( $arg );

    I was faced with one issue doinf this : with the RAND parameter, the query did NOT display all posts. strangely, it was displaying some posts twice, while not displaying some others…
    Strange also was the fact that the total number of displayed posts was the same as the expected total post from the database : it took me some days before detecting the issue.
    I haven’t fixed this issue yet : if anyone has a clue …

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP-PageNavi] is this possible? random posts while paged’ is closed to new replies.