• Hi!

    I’ve tried a lot of codes and plugins to do a random post. Some of them worked pretty well, but not the way I want. I want to display a random post on the front page, but I want that the random post looks like a regular post (with the title, the content, the date… everything!)

    I tried the Kafkaesqui’s code:

    <?php
    $rand_id = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_status = ‘publish’ ORDER BY RAND() LIMIT 1”);
    query_posts(“p=$rand_id”);
    ?>

    https://www.ads-software.com/support/topic/40818?replies=24

    It’s almost what I want… The only problem is that when I use this code, my index page only shows the random post (all the rest disappear!)

    I want to show 16 post on my index: 1 random post at the top, and 15 “regular” posts after that.

    What can I do?
    Thanks.

  • The topic ‘Random Post just like the regular posts’ is closed to new replies.