Random Post Generator

Last Update: October 01, 2015

Hi there! I was looking a couple of weeks ago for information on how to randomize posts in WordPress and found this link:


So far it's working just fine. Doesn't interfere with anything at least in the Twenty Thirteen theme that I'm using. I definitely wanted this feature in my website for the customer experience, but now I find that I'm actually using it a lot myself. It is a cool tool to check occasionally your old posts and see if there's any updating needed or any need to improve them in some tiny way.

I did have some help from my son to do this, but actually it isn't that hard!

1. Open the Random Post Generator link page in a new window
2. Go to your Dashboard
3. Go there to Appearance, then Editor
4. On the right side look for sidebar.php, click that open
5. Now go to the Random Post link page
6. Copy the code
7. Paste the code between

where it says

if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
<div id="tertiary" class="sidebar-container" role="complementary">
<div class="sidebar-inner">
<div class="widget-area">

and where it says

<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- .widget-area -->
</div><!-- .sidebar-inner -->

</div><!-- #tertiary -->
<?php endif; ?>

8. Remember to Update File!

If you want, you can change the Heading "Random Post" to something else, change the number of posts to anything you want (I have 3), or change the size of the Heading (probably too large for most, I changed it right away to bold instead of heading, that also takes away the extra line between the heading and the posts - to do that you substitute "h2" with "b").

Then when you Visit Site, the new feature should be on the right side above your secondary widgets, and the posts will then change randomly any time you click on anything on the page. I haven't figured out how to put it any place else, for I personally think that that's the best place for it. Easy access for the customer, readily seen. To see this feature in action, check my website http://jovestoneenergyastrology.com

I hope this comes handy for some of you! :)


Join the Discussion
Write something…
Recent messages
Dmorrow Premium
Cool! Thanks.
trevoreddy Premium
Thanks for the quick tutorial. Might use this!
Jovestone Premium
You're welcome, Trevor! I have to say I'm really pleased with that randomizer!