Home >Backend Development >PHP Tutorial >How does wordpress determine whether it is a mobile phone, tablet or PC and display the corresponding content-Mobile Detect, wordpress-mobile_PHP tutorial

How does wordpress determine whether it is a mobile phone, tablet or PC and display the corresponding content-Mobile Detect, wordpress-mobile_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:53:101277browse

How does wordpress determine whether it is a mobile phone, tablet or PC and display the corresponding content-Mobile Detect, wordpress-mobile

How does wordpress determine whether it is a mobile phone, tablet or PC access and display targeted content? Show specific content? Mobile Detect, a lightweight PHP class library, can implement this function very well. Moreover, Mobile Detect also has a plug-in available under WordPress – WP Mobile Detect. Wordpress uses this plug-in to easily implement the function of displaying specific content according to different terminal devices, such as responsive WordPress themes.

wordpress如何判断手机、平板还是PC并显示对应的内容-Mobile Detect - 第1张  | 吴川斌的博客

Install WP Mobile Detect plugin

Log in to the WordPress management background, select "Install Plug-in" on the plug-in management page, then enter the keyword "WP Mobile Detect" in the search box, then select "WP Mobile Detect" on the search results page and install it.

wordpress如何判断手机、平板还是PC并显示对应的内容-Mobile Detect - 第2张  | 吴川斌的博客

Install WP Mobile Detect plugin

wordpress如何判断手机、平板还是PC并显示对应的内容-Mobile Detect - 第3张  | 吴川斌的博客

Search for WP Mobile Detect plugin

How to use WP Mobile Detect

Annotate it with [keyword] in the wordpress article editor, for example

wordpress如何判断手机、平板还是PC并显示对应的内容-Mobile Detect - 第4张  | 吴川斌的博客

How to use Mobile Detect

Or use functions in php code to make judgments

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 when on phones ONLY
wpmd_is_tablet() – Returns true when on Tablets ONLY
wpmd_is_device() – Returns true when on phones or tablets but NOT destkop
wpmd_is_ios() – Returns true when on an 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:

Original article, please indicate when reprinting: Reprinted from Wu Chuanbin’s blog http://www.mr-wu.cn/

Link address of this article: How does wordpress determine whether it is a mobile phone, tablet or PC and display the corresponding content-Mobile Detect http://www.mr-wu.cn/mobile-detect-wordpress-plugin/

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1004401.htmlTechArticleHow does wordpress determine whether it is a mobile phone, tablet or PC and display the corresponding content -Mobile Detect, wordpress-mobile How does wordpress determine whether it is a mobile phone, a tablet or a PC? Access via mobile phone, tablet or PC, and display special features...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn