• 2010年03月12日
Position: IT杂志   \ 博客建设   \ POST CONTENT:

让IE6用户显示默认主题

作者:网络 发表于:2009-09-21   点击: 353 views

IE6的能力缺陷会使你好好的主题或者网页变的面目全非,而你又不肯放弃这部分读者,那就让IE6用户显示默认主题吧!(via

  1. add_filter('template', 'serve_default_to_iesix');
  2. add_filter('option_template', 'serve_default_to_iesix');
  3. add_filter('option_stylesheet', 'serve_default_to_iesix');
  4. function serve_default_to_iesix($theme) {
  5. if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false)
  6. $theme = 'default';
  7.  
  8. return $theme;
  9. }

把这段代码插入到你的functions.php中,或者做成插件:

  1. <?php
  2. /*
  3. Plugin Name: Serve Default to IE6
  4. Plugin URI: http://www.nathanrice.net/blog/serve-ie6-visitors-the-default-wordpress-theme
  5. Description: This plugin will serve the default theme to any visitors using IE6.
  6. Author: Nathan Rice
  7. Author URI: http://www.nathanrice.net/
  8. Version: 1.0
  9. */
  10.  
  11. add_filter('template', 'serve_default_to_iesix');
  12. add_filter('option_template', 'serve_default_to_iesix');
  13. add_filter('option_stylesheet', 'serve_default_to_iesix');
  14. function serve_default_to_iesix($theme) {
  15. if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false)
  16. $theme = 'default';
  17.  
  18. return $theme;
  19. }

把它做成一个插件激活即可了,如果你就想用现成的,那就下载这个吧download link(作者为你准备的)!这下世界安静啦!

相关文章

相关文章

赶快留言冒泡

  • 评论 (0)
  • 引用通告 (0)
目前还没有任何评论.
目前还没有任何Trackbacks和Pingbacks.
吐个泡浮上去.