利用下面的短代码,可以实现发布的内容在移动设备不可见。
function not_mobile_shortcode($atts, $content = '') { if (wp_is_mobile() === true) { $content = ''; } return $content; } add_shortcode('not_mobile', 'not_mobile_shortcode');将代码添加到主题 functions.php 中,发表文章时,插入短代码:[not_mobile]隐藏的内容[/not_mobile]
这样当用移动浏览器查看时被隐藏的内容将不可见。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持以下吧





