Forums

have problems randomizing the content! (1 post)

  1. sandrodz
    Member
    Posted 3 years ago #

    actually I'm running WP 2.3.

    I want to display random post taged as "featured" in my sidebar. So far I've gone this far:

    <?php
    $rand_posts = query_posts('tag=featured&amp;showposts=1');
    foreach( $rand_posts as $post ) :
    setup_postdata($post);
    ?>
    <h3>Featured Post</h3>
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Featured Post: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <?php global $more; $more = 0; the_content('more photos ยป'); ?>
    <?php endforeach; ?>

    but I'm having hell of a time randomizing the content, I have 5 featured posts, and I want to keep this number, but how do I loop through them? I waint it either random, or just 1 after the other displayed when page is refreshed. How could I acomplish this?

    btw, orderby=rand doesn't work :(

Topic Closed

This topic has been closed to new replies.

About this Topic