有什么办法可以做到这一点吗?
我的网站是http://kennethreitz.com http://kennethreitz.com。它由顶级 WordPress 上的一些中等 PHP 驱动。
我的选择是检测用户是否使用 iPhone,以及是否使用
a) 告诉 wordpress 加载我编写的不同“主题”。
b) 如果不可能,请在子域 (i.kennethreitz.com) 上安装不同的 WordPress,该子域在同一数据库中运行,并使用不同的主题。
出于 SEO 的原因,我宁愿能够做 A。
有任何想法吗?
http://www.nathanrice.net/blog/serve-ie6-visitors-the-default-wordpress-theme/ http://www.nathanrice.net/blog/serve-ie6-visitors-the-default-wordpress-theme/演示如何使用template过滤器动态更改 WordPress 主题(在本例中为 IE6,但也可以用于移动用户代理):
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;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)