Support » Plugins » Random posts with content

  • Hi,

    I want to show 5 random posts exactly as the posts that display on the index page, which includes title and content. Some other random posts plugin only able to show title


Viewing 1 replies (of 1 total)
  • this code works but it shows the pages as well. Is there a way to omit the pages?

    global $wpdb;
    $numposts = 10;

    $rand_posts = $wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE post_status = ‘publish’ ORDER BY RAND() LIMIT $numposts”);
    foreach($rand_posts as $post) :

    <?php endforeach; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Random posts with content’ is closed to new replies.