效果图
注意
仅手机端可以使用此功能 不是手机端将显示默认分享模拟框
部分浏览器不支持此功能 我仅测试过苹果默认浏览器 更多需自行测试 介意误购!!!
代码
functions.php代码
//分享按钮增强
function isSupportedBrowser()
{
// 获取浏览器 User Agent
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// 判断 User Agent 中是否包含移动设备的标识
if (preg_match('/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i', $user_agent))
{
return true;
} else {
return false;
}
// 检查 User Agent 是否包含常见的现代浏览器标识
$supported_browsers = array(
'Firefox',
'Chrome',
'Safari',
'Opera',
'Edge'
);
$browser_supported = false;
foreach ($supported_browsers as $browser) {
if (stripos($user_agent, $browser) !== false) {
$browser_supported = true;
break;
}
}
return $browser_supported;
}
/wp-content/themes/zibll/inc/functions/zib-footer.php代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容