The Random Terms with Random Posts plugin is built for the Wordpress blogging platform. This page outlines the usage techniques as well as details the available options and how to use them.
In order to properly use this plugin, you'll need to ensure the theme files for your site are editable (
chmod -R 777 via UNIX geekery, or get info through a FTP app and allow Read, Write, and Execute).
This plugin can be used in two different ways:
<?php echo ms_random(); ?>— this method will print a term/category and list of posts exactly where the code is placed
<?php $your_variable = ms_random(); ?>— this method will store the output from the plugin in a variable called
$your_variable, after which you can use
echo $your variable;to print the results on the page
There are several optional parameters you can use when calling the Random Terms w/ Random Posts plugin. Anything from the number of posts to get, which term/category to get posts from, all the way down to posts using a specific custom field.
Note: The parameters must be called in the order they are listed below. An example of calling the plugin with all the parameters will be at the bottom of this list.
$ms_list_type(string) choice of ul, p, or br
HTML to display the list of posts. ul will show the list of posts as a regular list. p will show the posts as separate paragraphs. br will show the posts in one paragraph, using line breaks (
<br />) after each post title (and excerpt if the option is enabled). Default is ul.
Option to specify what
HTML tag will be surrounding the term/category headline. Class names and/or ID's can be used in this optional parameter. Default is h2.
Option allows the inclusion of post excerpts, if one has been provided. Default is false.
Option to specify the number of posts to show. If fewer posts than specified are in the given term/category, all posts will be shown in a random order. Default is 5.
Option to override the random choice of term/category. By specifying this parameter, only posts from the chosen term/category id will be loaded. You can also exclude specific categories by adding “-exclude” after the term ID. For example
12-exclude. Default is NULL.
Option to specify a custom field for the plugin to search for. If specified, the custom field overrides the random term/category or specified term/category. The
$ms_custom_value option is required if this option is specified. Default is NULL
Option to state what value to search for in
$ms_custom_field, in the Wordpress database. Default is NULL
If you wanted to specify the optional parameters, you would call the plugin like so:
<?php echo ms_random('ul', 'h2 class="test"', true, 8, '', 'foo', 'bar'); ?>
In this example, the plugin would:
<h2>tag with a class of "test"
Version 0.7 — November 13, 2007
Version 0.6 — November 9, 2007
Version 0.5 — October 23, 2007
includeExcerptparameter to optionally allow showing the post’s excerpt content
Version 0.4.3 — March 23, 2007
Version 0.4 — January 18, 2007
nullvalues it will still display results
Version 0.3 — March 25, 2006
Version 0.2.5 — January 10, 2006
Version 0.2.3 — November 14, 2005