<?php //哔哩哔哩视频自适应短代码功能 function zke_shortcode_1($atts, $content = null) { extract(shortcode_atts(array( 'url' => '', 'height'=>'', ) ,$atts)); $height = $height ? $height : '896px'; // 要做的事情. $message = '<iframe id="zkvideo" src="'.$url.'" width="100%" height="100%" frameborder="no" scrolling="no" allowfullscreen="allowfullscreen" style="height: '.$height.';"> </iframe> <script type="text/javascript">document.getElementById("zkvideo").style.height=document.getElementById("zkvideo").scrollWidth*0.8+"px"</script> '; // 返回输出 return $message; } // 注册短代码 add_shortcode('bilibili', 'zke_shortcode_1');
本文作者:𝙕𝙆𝘾𝙊𝙄
文章名称:哔哩哔哩自适应WP功能短代码
文章链接:https://www.zkcoi.com/365up/program/2354.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。