IE6的能力缺陷会使你好好的主题或者网页变的面目全非,而你又不肯放弃这部分读者,那就让IE6用户显示默认主题吧!(via)
- add_filter('template', 'serve_default_to_iesix');
- add_filter('option_template', 'serve_default_to_iesix');
- add_filter('option_stylesheet', 'serve_default_to_iesix');
- function serve_default_to_iesix($theme) {
- if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false)
- $theme = 'default';
- return $theme;
- }
把这段代码插入到你的functions.php中,或者做成插件:
- <?php
- /*
- Plugin Name: Serve Default to IE6
- Plugin URI: http://www.nathanrice.net/blog/serve-ie6-visitors-the-default-wordpress-theme
- Description: This plugin will serve the default theme to any visitors using IE6.
- Author: Nathan Rice
- Author URI: http://www.nathanrice.net/
- Version: 1.0
- */
- add_filter('template', 'serve_default_to_iesix');
- add_filter('option_template', 'serve_default_to_iesix');
- add_filter('option_stylesheet', 'serve_default_to_iesix');
- function serve_default_to_iesix($theme) {
- if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false)
- $theme = 'default';
- return $theme;
- }
把它做成一个插件激活即可了,如果你就想用现成的,那就下载这个吧download link(作者为你准备的)!这下世界安静啦!
网站首页
站长作品
网站服务
留言交流
建议提交