Mobile detective plugin
About the plugin
“Mobile detective” plugin was created to help webmasters determine types of visitors’ devices.
And according to the device type show actual information or redirect to a proper url.
The plugin not only detects more than 150 different device types. Not only PC/tablet/phone or OS but also a wide range of vendors.
This plugin allows to combine different types using logical operations (OR, AND, NOT)
Configuring the plugin.
- Login to your WP site with the administrator’s credentials.
- Go to Settings->Mobile Detective.
- In the lower part of the page you will see a table called “Groups”. Here you set up rules what you will need. For example let’s create a group (rule) to detect mobile devices from Samsung.
- Click on the button “create ne group”. And create group “SamsungMobile”.
- In the column “Add to group” select “IsMobile” and click “Add option”
- Select “IsSamsung” and click “Add option”
- You can delete a rule from the group (column “Delete from group”), delete or rename a group.
- Don’t forget to click “Save changes”
- You need define a group only when you want to combine several rules (logical AND is calculated for all rules in the group). Though you may use a group consisting only one rule.
How to use
A simple way.
All you need is to place . You can see the result at this demo page.
An advanced technique.
Sometimes you can get something like “Failed $detect->isMobile()”. This means that your rule failed (for this example the message appears when you test on desktop PC. To avoid such bad message you should use parameter output.
if you will use the next code [МobDetective isMobile output="This is a desktop PC"] This is a mobile device[/МobDetective]
(NOTE that this code can’t be copied directly because letter M is changed to another that looks like as M but is not M)
You will get a normal answer without any fail message: This is a desktop PC.
Complex conditions
You can combine conditions in the next ways:
- When you put several conditions in one group they are joined by logical OR
- While setting conditions on the page use
[МobDetective Condition1 Condition2...]...[/МobDetective]
This conditions would be joined by logical AND. ATTENTION this works only with groups not with simple rules.
You can see the result at this demo page.
Redirect
Instead of showing something when condition failed (option output) you can redirect you visitor to another page by using option redirect. You must just put code like this:
MobDetective Tablet redirect="http://yoursite.com"]This is a Tablet[/MobDetective]
Download
You can download this plugin at wordpesss.org
"mob" is not valid check name