Generating a Random Post in WordPress Using Shortcodes Ultimate

Shortcodes Ultimate by Vladimir Anokhin is a popular plugin for WordPress supplying numerous helpful shortcodes to add various features to your posts.

Here’s how to generate a random post on a self-hosted site using Shortcodes Ultimate.

  1. Install the Shortcodes Ultimate plugin if you haven’t already.
  2. On your server, in the “wp-content/plugins/shortcodes-ultimate/” folder, create a new file called “random-post.php”. You can do this through the file manager on CPanel or other frontend on your host (or through SSH if you have command line access).
  3. Edit the “random-post.php”, adding the following content:

  4. Save the file.
  5. Create a new post in WordPress.
  6. Click on the Shortcodes Ultimate button in your editor:

  7. A dialog will open. Click on the “Posts” code:

  8. Edit the Template name to read “templates/random-post.php” to match the name of the template you just created.
  9. Complete the rest of the dialog options. When finished, click “Insert” to insert the Posts short code.
  10. Preview the post to verify that a random post was inserted.

Leave a Reply

Your email address will not be published. Required fields are marked *