php - wordpress show random posts while paged -
i have 700 artworks (custom post type) , want break them in pages, have in random places each time.
the problem when use
'paged'=>$paged, 'posts_per_page' => 60, 'orderby'=>rand
each page repositions post , can find same post on ex. 2nd , 7th page.
is there way first random posts , break them pages? or randomise posts per session, or per ip?
my assumption 'orderby' => rand
selects random post 1 @ time, each time has option display post option rand
chooses 1 database @ random, independent of rest of page , posts.
a possible solution problem take different approach together.
every time homepage visited call php script randomly generate list of unique numbers, once every post (in case, 0-700). modify database (either adding column posts row, or modify/append existing one) said random number. set order new/modified column, ensuring the posts randomized every visitor page, never displays same post twice. however...you need test it, i've never modified 'orderby' variable in code itself, since i've never had need to.
you try doing similar above, instead change orderby option in backend (as opposed code), assuming theme gives option (which imagine would).
i hope solves problem.
Comments
Post a Comment