Support » Themes and Templates » Random and recent post widget

  • Most of the themes have a sidebar widget with recent/polular and random posts widget. Those widgets show post thumbnails too
    Please if anyone could share the code. Also, i’m trying to avoid timthumb so please provide a code which does not use timthumb

    [No bumping, thank you.]

Viewing 1 replies (of 1 total)
  • Moderator t-p


    try this:

    <!--- Random Post -->
    			<li id="randompost" class="widget-container">
                <h3 class="widget-title"><?php _e( 'A Random Post', 'twentyten' ); ?></h3>
                   $rand_posts = get_posts('numberposts=1&orderby=rand');
                  foreach( $rand_posts as $post ) :
                 <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                <?php endforeach; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Random and recent post widget’ is closed to new replies.