You might have noticed that uses a small Shuffle button which will take you to the random Images,Likewise also had a little Explore button on Navigation menu to randomly explore their contents.So in this post I have explained how to make random article explore button on WordPress.

Before beginning the lets analyze the advantage of using explore button.

1. Increases the Pageviews per user.

2. Useful to show up your old archive articles.

First of all find your Current themes Function.php and add the following code.If you use Thesis theme then you can paste this code on custom_functions.php

function random_add_rewrite() {
       global $wp;
       add_rewrite_rule('random/?$', 'index.php?random=1', 'top');

function random_template() {
       if (get_query_var('random') == 1) {
               $posts = get_posts('post_type=post&orderby=rand&numberposts=1');
               foreach($posts as $post) {
                       $link = get_permalink($post);

Now if you go to (replace with our website name) you will be redirected to random article in your blog

You can use it with a Explore button to redirect the users like one you will see at the end of this post,the code I have used to do this
<div style="text-align:center;">
<a href="">
<img src="" alt="Explore Techiestuffs"/>

You can use your own Image and you can place this code on your sidebar using a Text widget.

You can Also display Explore button on your navigation menu,


Use your random article url in URL field and Give some suitable name to Navigation Label.Title attribute is the text displays when you hover over the menu item so give some brief title to it also.

Comment back if you have any difficulties in implementing this code.

Similar Posts