Support » Plugins and Hacks » show random posts in this code

  • jack randall

    (@theotherlebowski)


    hello, i was wondering if any code gurus out there might be able to help: i’ve got client who’s using a child of the Neptune theme on her site and she wants to have the recent posts sidebar doodah to show a random selction of posts (obviously i’ll need to rename the doodah!) rather than the top 6 newest posts.

    this is the code that fetches and outputs:

    <ul>
    <?php
    	$my_query = new WP_Query('showposts=6');
    	while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
    ?>
    <li>
    
    	<?php if ( has_post_thumbnail() ) {?>
    	<a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>">
    	<?php  the_post_thumbnail( 'neptune-minithumb', array('class' => 'custim3') );?></a>
    	<?php } else { ?>
    
    	<?php } ?>
    
    </li>
    
    <?php endwhile; ?>
    </ul>

    i know there’s a MySQL call for generating random results but my php coding chops aren’t up to the job i’m afraid. can anyone see where if at all i can make changes to this code to make it show the random selection?

    the site in question is hierophant-nox.com if you want to take a look see the end results.

    big thanks in advance guys. 😀

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘show random posts in this code’ is closed to new replies.