How to Display Random Posts in WordPress

If you  want to display random posts in WordPress.  Here we will show you how to display random posts in your wordpress sites.

By default WordPress allows users to see your latest posts first. Most users will not get to see your older articles. There are two type of method to display random posts in wordpress- with a plugin, with a code.
WP Technical Support

First Method

Firstly you need to install and activate a Random Post Widget plugin. Then you need to visit Appearance<<widget.

After this you need add this widget to a slidebar,then you see a widet setting. You just click save button.

This widget is a powerfull plugin with lots of customization option. In this you can select different post types, show thumbnail, or displays posts from specific categories or tags.

Second Method  

  • Open sidebar.php, text widget
  • Copy and paste the function:



‘cat’ => 1,

‘orderby’ => rand,

‘post_type’ => ‘post’,

‘post_status’ => ‘publish’,

‘posts_per_page’ => 4,

‘caller_get_posts’=> 1


$my_query = null;

$my_query = new WP_Query($args);

if( $my_query->have_posts() ) {

while ($my_query->have_posts()) : $my_query->the_post(); ?>

<p><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_post_thumbnail(); ?><?php the_title(); ?></a></p>


$name = get_post_meta($my_query->post->ID, ‘WritersName’, true);

if ($name){

echo ‘Writers name: ‘ .$name;




wp_reset_query();  // Restore global post data stomped by the_post().


  • Change details in $args array
  • Save changes.

With the help of this you can display random posts in wordpress. If you want more help contact our WordPress Technical & Support Helpline Number


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s