Warning: unlink(/var/www/html/robots_log.txt.lock): No such file or directory in /var/www/html/wp-content/plugins/wp-log-robots/wp-log-robots.php on line 112 WordPress根据UA切换主题 – 王正东博客

WordPress根据UA切换主题

function ua_switching_theme() {
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'yunluo') !== false) {
        $theme = 'Git-alpha';
    } else {
        $theme = 'html5blank';
    }
    return $theme;
}
add_filter('template', 'ua_switching_theme');
add_filter('stylesheet', 'ua_switching_theme');

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据