[memb_is_mobile]

Version Added v1.00

Summary

This conditional shortcode checks if the user is visiting using a mobile device.

Shortcode Examples

[memb_is_mobile]
Display this content on mobile 
[else_memb_is_mobile]
Display this content to a user who's not on mobile
[/memb_is_mobile]

The below shortcode displays the word “No” if you’re not on mobile, and “Yes” if you’re on mobile:

[memb_is_mobile]

To show the content only on mobile device, you’d use:

[memb_is_mobile]
Display this content on mobile 
[/memb_is_mobile]

Description

This conditional shortcode checks if the user is visiting using a mobile device. This is conditional shortcode.

This shortcode works through the detection of the browser user agent string. The function searches for any of the following terms: Mobile, Android, Silk/, Kindle, BlackBerry, Opera Mini, or OperaMobi. It does not use the resolution, window width, or any other measurements to determine if the device is mobile.

The shortcode is a wrapper for the built-in WordPress function wp_is_mobile(). We recommend you use that function directly for your template code.