/ Published in: PHP
                    
                                        
Display random posts without a plugin
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<ul>
<?php $rand_posts = get_posts('numberposts=5&orderby=rand');
foreach( $rand_posts as $post ) : ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                