Add Random Text or HTML to your WordPress Sidebar

Random Text & HTML

Sometimes you just want random stuff in your sidebar.

Maybe an image? A video? A quote? Links to your favourite posts?

There’s a plugin for that. ๐Ÿ™‚

The Random Text Plugin

Random Text Plugin

You can think of the Random Text plugin as a close relative of the core Text widget, with two key differences: randomization (hence the name) and categorization. Simplistic? Absolutely. But the simplicity of the Random Text plugin is what makes it so great.

With a bit of HTML knowledge and smart categorization, there’s a lot that you can do with this plugin. For example, one of our team members is working with a client who has a large collection of facts and images that they want to feature on their sidebar. The Random Text widget makes this very easy to do!

Setting Up the Random Text Plugin

From your dashboard, mouse over PLUGINS and click ADD NEW.

WordPress > Plugins > Add New

We’re looking for the “RANDOM TEXT” plugin. Click SEARCH.

Search Random Text

The Random Text plugin should be the first result. The author of the plugin is Greg Jackson.

Random Text Plugin - Search Result


After the plugin has been installed, click ACTIVATE PLUGIN.

Once the plugin has been activated, mouse over SETTINGS and click RANDOM TEXT.

Settings - Random Text

This is the Random Text setup screen. When you first install the plugin, a couple of default entries are created.

Random Text - Default Entries

Let’s get rid of those.

In the ACTION column, click DELETE for the demo entries.

Random Text - Delete Entry

Also take note of the “View all categories” dropdown menu. If you’re working with multiple categories of random items, this little menu becomes essential to help you keep track of what items are assigned to what categories.

Random Text - View Categories Menu

Adding Random Text

Now we’re ready to go! Click the ADD NEW button.

Random Text - Add New

This takes you to the Random Text – Add New screen. You’ll fill this out for each new randomized item.

Random Text - Add New

These are the fields you’ll be working with:

  • Text To Display: Holds the text, or HTML, that you’d like to randomly display on your sidebar widget.
  • Category: Assign this entry to a category or create a new category. Categories are how you organize your random text entries. You’ll be able to choose what category to display in the Random Text sidebar widget.
  • Is Visible: Simple enough – do you want this entry to be displayed on the site?
  • Use Bulk Insert: Sets to “No” by default. If you enable it, each line in the Text To Display textbox is treated as a separate item. *Very* useful!

Once you’ve entered your details, click SAVE CHANGES.

WordPress Settings > Save Changes

Repeat this process for each item that you’d like to add.

For demonstration purposes, we’re going to drop in some placeholder images from

Random Text - Add New - Placekitten

Adding Random Items to your Sidebar

Now that we’ve added the items we want to display on the site, we need to drop in the widget.

On your dashboard, mouse over APPEARANCE and click WIDGETS.

WordPress - Appearance - Widgets

In the AVAILABLE WIDGETS section, look for the RANDOM TEXT widget. Drag it into your sidebar. Expanding the widget displays five options:

Random Text - Widget Options

  • Title: The title of the widget.
  • Pre-Text: Text or basic HTML that you’d like to prepend to the random item.
  • Category: The Random Text category that you’d like to display in the widget.
  • Post-Text: Text or basic HTML that you’d like to append to the random item.
  • Selection: Choose either “Rotation” or “Random”. The more items you have, the more resources you’ll need to process the randomization. There’s also a chance that some items will be repeatedly displayed, while others are rarely (or never) displayed. Such are the ways of random selection!

After setting your preferences, click SAVE.

In our case, we’re going to call the widget Kitties; wrap the placeholder images in red border and image tag; and pull the image URLs from our Kittens category:

Random Text - Widget Options

Tip:ย The Random Text plugin also supports shortcodes and template tags, if you’d like to include this random goodness somewhere else on your WordPress site. ๐Ÿ™‚

View The Results

Mouse over your site title in the WordPress toolbar and click VISIT SITE.

The randomized items should now appear on your sidebar. Refresh the page to see the different items display.

Random Text - Widget

Kudos to Greg Jackson, author of the Random Text plugin, for creating such a useful tool!

About the author