Пример #1
0
function hocwp_theme_switcher_to_mobile_control($name)
{
    $mobile_theme = hocwp_theme_switcher_get_mobile_theme_name();
    if (!empty($mobile_theme)) {
        $name = $mobile_theme;
    }
    return $name;
}
function hocwp_theme_switcher_wp_init()
{
    if (!is_admin()) {
        $theme = hocwp_get_method_value('theme', 'get');
        if (empty($theme) && hocwp_is_force_mobile()) {
            $theme = hocwp_theme_switcher_get_mobile_theme_name();
        }
        if (!empty($theme)) {
            hocwp_set_session('hocwp_current_theme', $theme);
            hocwp_set_cookie('hocwp_current_theme', $theme, time() + DAY_IN_SECONDS, '/');
            if (is_user_logged_in()) {
                $unique = get_current_user_id();
                update_option('hocwp_user_' . $unique . '_theme', $theme);
                unset($unique);
            }
        }
        unset($theme);
    }
}