WordPress.org

Ready to get started?Download WordPress

Forums

Displaying random posts on my main page (5 posts)

  1. arczi19
    Member
    Posted 3 years ago #

    Heya
    I've recently started using WordPress and I came across kinda annoying problem. Is there a way I could display random posts on my main page rather then the latests one? If so, how do I do it? I've looked through google, found some out of dated tips, none of them worked tho :<

    Many thanks,
    Ryan

  2. cangpo
    Member
    Posted 3 years ago #

    You need to create custom query loop with posts, and change order to random.

  3. arczi19
    Member
    Posted 3 years ago #

    Figured that, not sure how to get to it tho :<

  4. cangpo
    Member
    Posted 3 years ago #

    <?php $index_query = new WP_Query('post_type=post&showposts=10&orderby=rand'); ?>
    <?php while ($index_query->have_posts()) : $index_query->the_post(); ?>
    code here...
    <?php endwhile; ?>
  5. cangpo
    Member
    Posted 3 years ago #

    You need the paginator?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.