WordPress How to determine the phone, tablet or PC and display the corresponding content-mobile detect,wordpress-mobile_php tutorial

Source: Internet
Author: User

WordPress How to judge the phone, tablet or PC and display the corresponding content-mobile detect,wordpress-mobile


How does WordPress determine whether a mobile phone, tablet or PC is accessed and targeted to display specific content? Mobile Detect This lightweight PHP class library is a great feature to implement. And Mobile Detect also has WordPress under the plugin available-WP Mobile Detect,wordpress Use this plugin, it is easy to achieve the different terminal devices to display specific content functions, such as the responsive WordPress theme.

Installing WP Mobile DETECT plugin

Login to WordPress management background, in the Plugin management page, select "Install plugin", and then search box enter the keyword "WP mobile Detect", and then search results page li select "WP mobile Detect" and install.

Installing WP Mobile DETECT plugin

Search WP Mobile Detect plugin

WP Mobile detect how to use

In the WordPress article editor, use [keywords] to annotate, for example

Mobile Detect How to use

Or you could use a function to judge in PHP code.

Wpmd_is_notphone () –returns True when on desktops or tablets
Wpmd_is_nottab () –returns True when on desktops or phones
Wpmd_is_notdevice () –returns True when on desktops only
Wpmd_is_phone () –returns True when on phones only
Wpmd_is_tablet () –returns True when on Tablets only
Wpmd_is_device () –returns True when on phones or tablets and not Destkop
Wpmd_is_ios () –returns True when on iOS device
Wpmd_is_iphone () –returns True when on IPhones
Wpmd_is_ipad () –returns True when on iPads
Wpmd_is_android () –returns True when on Android
Wpmd_is_windows_mobile () –returns True when on Windows Mobile

For example:

12345678910111213 !--? php if (Wpmd_is_phone ()) {"") Mobile-only visible content !--? php} else if (Wpmd_is_tablet ()) {, !--? php} else {; pc visible content only !--? php}?-->

original articles, reproduced please specify: reproduced from Wuchuanbin blog http://www.mr-wu.cn/

This article link address: How to judge the mobile phone, tablet or PC and display the corresponding content-mobile Detect http://www.mr-wu.cn/mobile-detect-wordpress-plugin/

http://www.bkjia.com/PHPjc/1004401.html www.bkjia.com true http://www.bkjia.com/PHPjc/1004401.html techarticle WordPress How to judge the phone, tablet or PC and display the corresponding content-mobile detect,wordpress-mobile WordPress How to determine whether the phone, tablet or PC access, and targeted display special ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.