WordPress.org

Forums

[resolved] Random Posts on main page? (4 posts)

  1. RUTickedOff
    Member
    Posted 8 years ago #

    Instead of the 5 newest posts I would like to display 5 random posts. Anyone know how I could do this? http://www.rutickedoff.com is my blog. I don't update it very often so rotating the posts is a good idea.

    Thx

  2. Kafkaesqui

    Posted 8 years ago #

  3. RUTickedOff
    Member
    Posted 8 years ago #

    I read over that post, but I don't understand where to put that code? Below is my loop I think. What would I need to change to get the random posts and still keep my css and my exerpt_reloaded?

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="posttitle">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    </div>

    <div class="entry">
    <?php the_excerpt_reloaded(100, '<img>', 'content', TRUE, '(Read the rest...)'); ?>
    </div>

    <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>

    <?php endwhile; ?>

  4. RUTickedOff
    Member
    Posted 8 years ago #

    I figured out where to put the code and it worked beautifully thanks for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags