Display 4 chronological posts starting with a random post
For a random offset we might try: $ppp = 4; $total = wp_count_posts()->publish; $offset = $total < $ppp ? 0 : rand( 0, $total – $ppp ); $posts = get_posts( [ ‘posts_per_page’ => $ppp, ‘offset’ => $offset ] ); Example: Let’s take $ppp as 4 and assume $total is 6. Then are three possibilities for … Read more