开发者 | dolby_uk |
---|---|
更新时间 | 2017年10月11日 17:22 |
捐献地址: | 去捐款 |
PHP版本: | 3.1 及以上 |
WordPress版本: | 4.6 |
mobile-smart
directory to the /wp-content/plugins/
directorySee http://www.mobile-smart.co.uk/frequently-asked-questions/ for more. It would be advisable not to use other mobile theme switching functionality with this unless theme switching is turned off (go to Settings->Mobile Smart to disable). This has been tested with the Wordpress Mobile Pack transcoder and is noted to be compatible, though the list of mobile devices are different between the two.
Go to the Mobile Theme tab in the Settings->Mobile Smart admin page, and enable / disable tablet support.
If you wish to serve up different styles for tablets, you'll have to modify your template to use the template tags to detect:
<?php /* add additional stylesheet for certain mobile types */ global $mobile_smart; // add stylesheets dependent on header if ($mobile_smart->isTierTablet()) { wp_enqueue_style('mobile-tablet', get_bloginfo('stylesheet_directory')."/css/tablet.css"); } ?>
You can use the same template tag (isTierTablet()) to display additional content (such as sidebars, etc).
You have the option of the following:
Go to http://www.mobile-smart.co.uk/ for more information on the Mobile Smart Pro plugin.
To enable the CSS body classes, ensure that in your mobile theme you have the body_class() function included:
<?php body_class(); ?>
How do I use the body classes? If you have a style that you only want a specific tier of device (e.g. touch handsets like the iPhone) to use, then use the body class CSS selector in your CSS file as follows: (Example: / for all links / a { color: black; } /* increase padding on anchors on touch handsets to allow for big fingers .mobile-tier-touch li a { padding: 20px; }
You would do this if you prefer to split out each device tier CSS into separate files. Be aware that this creates an extra function call though.
Use the following PHP code:
<?php /* add additional stylesheet for certain mobile types */ global $mobile_smart; // add stylesheets dependent on header if ($mobile_smart->isTierTouch()) { wp_enqueue_style('mobile-touch', get_bloginfo('stylesheet_directory')."/css/touch.css"); } else if ($mobile_smart->isTierSmartphone()) { wp_enqueue_style('mobile-smartphone', get_bloginfo('stylesheet_directory')."/css/smartphone.css"); } ?>
Note: these functions do not test for the Manual Switcher. To test for the manual switcher (in case you are using
these template tag functions in a desktop theme), you should call:
<?php /* add additional stylesheet for certain mobile types */ global $mobile_smart; // find out manual switching state $is_manual_switched_to_mobile = $mobile_smart->switcher_isMobile(); ?>
Please email me with details of the device that is not yet supported by Mobile Smart, and I will add it in, and endeavour to release an updated version within the week (if timescales allow).
Try the Mobile Smart boilerplate theme if you're a developer. Also check out the Wordpress Mobile Pack for a good example of a theme that is compatible with XHTML-MP.