and like us on FB

Insults has to be one of the most pointless plugins in the WordPress repository. It was the first plugin we ever submitted to WP and was done so – like a few others – just to test the WordPress waters and get a feel for how their approval process worked. The plugin will retrieve an ‘insult’ from a database of thousands and return it. Simple. Like all plugins, it’ll find its place somewhere.

This post will show you how to access a random insult via our API with shortcode, PHP, or with our WordPress plugin.

The Results

The result of this function will render something like this on your website:

“I can't believe that out of 100,000 sperm, you were the quickest!“

Cheesy, we know.

WordPress Shortcode

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Usage

Insert the shortcode of [insult] wherever it is you want your insult to be rendered. The default code will cache the text for 1 hours (3600 seconds) but you can get them as often as every 6 minutes. We cache the text locally on our end for 5 minutes.

PHP Function

Used outside of WordPress, the following PHP function may be used. It requires the use of Simple Cache.

Download

The plugin version is hosted in the WordPress plugin repository.

Plugin Title: INSULTS Author: beliefmedia
Description: Insults is an extremely simple plugin that’ll generate a random insult on your website every hour.
Download (downloaded 239 times) | Plugin Page

Title: Display a Random Insult
Description: Display a Random Insult on Your Website with PHP or WordPress Shortcode.
Download: Shortcode (V0.2) | PHP Code (V0.2) | Plugin Page

Shortt URL for this post: http://shor.tt/102G