Device Detect

Device Detect allows you to detect the device of the user, and to easily insert into posts, pages and widgets of your website some contents only for the phones, tablets or computers. It improves the wp_is_mobile function of WordPress and provides functions that can be used in your WordPress theme to make your website responsive and perfectly adapted to phones, tablets and computers.

WordPress Download

Summary

  1. Installation
  2. Upgrade
  3. Contents Restricted To Phones
  4. Contents Restricted To Tablets
  5. Contents Restricted To Computers
  6. FAQ [+]
    1. How can I use shortcodes in my WordPress theme?
    2. How can I use shortcodes in comments?

1. Installation

You can install Device Detect through the Add Plugins page of the Plugins menu in WordPress (Plugins => Add New => Upload Plugin). Upload the plugin file without unzipping it. You can also install it like this:

  1. Unzip the plugin file.
  2. Upload with your FTP software the device-detect folder, and only this folder, to your plugins directory (it should be wp-content/plugins).

Once you have installed Device Detect, activate the plugin through the Plugins menu in WordPress.

2. Upgrade

When you upgrade Device Detect, you don't lose any settings or any data.

You can upgrade Device Detect through the Plugins menu in WordPress, and through the WordPress Updates page of the Dashboard menu in WordPress (Dashboard => Updates). You can also upgrade it like this:

  1. Unzip the plugin file.
  2. Upload with your FTP software the device-detect folder, and only this folder, to your plugins directory (it should be wp-content/plugins), without deleting the device-detect folder that already exists in this directory.

You don't need to deactivate and reactivate the plugin.

3. Contents Restricted To Phones

To display a content restricted to phones, insert into your posts/pages/widgets a code like this:

[phone-content]Content displayed if you view this page through a phone[/phone-content]

You can also define a content that will be displayed if the user doesn't view the page through a phone, like this:

[phone-content]
Content displayed if you view this page through a phone[other]
Content displayed if you don't view this page through a phone
[/phone-content]

Result (with a little formatting):

Content displayed if you don't view this page through a phone

4. Contents Restricted To Tablets

To display a content restricted to tablets, insert into your posts/pages/widgets a code like this:

[tablet-content]Content displayed if you view this page through a tablet[/tablet-content]

You can also define a content that will be displayed if the user doesn't view the page through a tablet, like this:

[tablet-content]
Content displayed if you view this page through a tablet[other]
Content displayed if you don't view this page through a tablet
[/tablet-content]

Result (with a little formatting):

Content displayed if you don't view this page through a tablet

5. Contents Restricted To Computers

To display a content restricted to computers, insert into your posts/pages/widgets a code like this:

[computer-content]Content displayed if you view this page through a computer[/computer-content]

You can also define a content that will be displayed if the user doesn't view the page through a computer, like this:

[computer-content]
Content displayed if you view this page through a computer[other]
Content displayed if you don't view this page through a computer
[/computer-content]

Result (with a little formatting):

Content displayed if you view this page through a computer

6. FAQ

6.1 How can I use shortcodes in my WordPress theme?

Insert into the PHP files of your theme a code like this:

<?php echo do_shortcode('[your-shortcode]'); ?>

6.2 How can I use shortcodes in comments?

Edit the functions.php file (create it if it doesn't exist) of your WordPress theme and add this line of code:

add_filter('comment_text', 'do_shortcode');