Analyst/Consultant/Coder

WP-Bot-Content

WP-Bot-Content is a small but handly plugin that allows you to hide content from or show additional content to individuals or bots (a.k.a. entities) browsing your WordPress site. By using a simple shortcode you can hide or show content, strip external links from content, and send email notifications all based on whether the entity is a bot, a guest, or a member who is logged in.

WP-Bot-Content allows you to manipulate content for three basic entities: bots, users and everyone else by using three sets of entity flags onBot=”", onUser=”", and onElse=”".  You can include all three sets of entity flags or none of them on the shortcode.  For any set of flags that is excluded the defaults for that entity will be applied (see below).

Each set of entity flags has three components which are (in strict order):

  1. Visibility – flag indicating whether or not content within the short code is to be hidden or shown to the entity.  Values are one of the following values: {show/blank}.  The default is hidden.
  2. Notification – flag indicating whether or nor  an emails is to be sent when the entity browses the content.  Possible values are {notify/blank}.  The default is to not send and email notification.
  3. Link Strip – flag indicating whether or not the content is to be stripped of external links.  Possible values are: {strip/blank} and the default is to not strip external links.

A typical set of entity flags for bots looks like this:

[[wp-bot-content onBot="show,,strip"] … keyword content … [/wp-bot-content]]

Entity flags to hide advertisements from bots and users who are logged in would be:

[[wp-bot-content onBot="hide,," onUser="hide,,"] … ad content … [/wp-bot-content]]

To show content for bots and strip external links, show content for guests and notifiy the site owner, and hide it for users who are logged in.

[[wp-bot-content onBot="show,,strip" onElse="show,notify,"] … content … [/wp-bot-content]]

and finally, this code only sends an email when users browse the page:

[[wp-bot-content onElse=",notify,"/]]

One very important item worth mentioning is the fact that each entity type has different defaults which are applied when the entity flags are excluded from the short code and they are different than the defaults for the individual flags themselves.  They are as follows:

  • onBot=”show,,strip”
  • onUser=”hide,,”
  • onElse=”show,,”

The shortcode also supports four other parameters related to email notifications:

  • emailto=”address@server.com” – “To:” email address
  • emailtoname=”John Doe” – “To:” recipient name
  • emailfrom=”noreply@myserver.com” – “From:” sender email address
  • emailfromname=”Tom Servo” – “From:” sender name

So as you can see there are many ways to use the WP-Bot-Content plugin. You can download the plugin from the downloads page of this site. If you find the plugin useful please consider a donation to the coffee fund.  Enjoy!

Freedom from the cubicle.
“War is an instrument entirely inefficient toward redressing wrong; and multiplies, instead of indemnifying losses.”

~Thomas Jefferson

Copyright © 2011. All Rights Reserved.