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 Code class= "PHP keyword" >if (Wpmd_is_phone ()) {? </DIV> <?php} else if (Wpmd_is_tablet ()) {, <DIV> </DIV> <?php} else {; <DIV> PC-only visible content </DIV> <?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/
WordPress How to judge the phone, tablet or PC and display the corresponding content-mobile Detect