知更鸟主题(Begin)在文章里添加B站视频的方法 – WordPress都可用

因为要在文章里插入B站的视频,因为很简单的,贴下分享代码就可以了,或者用知更鸟的方法,把播放地址贴进去就可以了,预览的时候才发现没有这么简单。

B站可能限制了外链,所以贴的视频很小,需要自己调整,有不少视频都是放在B站的,平时最喜欢逛的视频站也是B站,这篇文章就来分享如如何在文章里贴B站视频,wordpress应该都是通用的,不过用的是知更鸟主题,所以说说这个主题如何设置。

一:贴代码

在主题设置→定制风格→自定义样式了贴进如下代码:

.smartideo { z-index: 0; text-align: center; background: #CCC; line-height: 0; text-indent: 0; }
.smartideo embed, .smartideo iframe { padding: 0; margin: 0; }
.smartideo .player { width: 100%; height: 500px; overflow: hidden; position: relative; }
.smartideo .player a.smartideo-play-link { display: block; width: 50px; height: 50px; text-decoration: none; border: 0; position: absolute; left: 50%; top: 50%; margin: -25px; }
.smartideo .player a.smartideo-play-link p { display: none; }
.smartideo .player .smartideo-play-button { width: 0; height: 0; border-top: 25px solid transparent; border-left: 50px solid #FFF; border-bottom: 25px solid transparent; }
.smartideo .tips { background: #f2f2f2; text-align: center; max-height: 32px; line-height: 32px; font-size: 12px; }
.smartideo .tips a { text-decoration: none; }
 
@media screen and (max-width:959px){
    .smartideo .player { height: 450px; }
}
@media screen and (max-width:767px){
    .smartideo .player { height: 400px; }
}
@media screen and (max-width:639px){
    .smartideo .player { height: 350px; }
}
@media screen and (max-width:479px){
    .smartideo .player { height: 250px; }
}

如图:图片[1]-知更鸟主题(Begin)在文章里添加B站视频的方法 – WordPress都可用-七玩网

二:贴视频

这里贴一个小时候不敢看的广告:

https://www.bilibili.com/video/BV14s41167Rp?zw

贴法如下:

<div class="smartideo">
<div class="player"><iframe src="//player.bilibili.com/player.html?aid=6069379" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="100%" height="100%"> </iframe></div>
</div>

把要分享的视频代码更换掉就可以了,大概就这么个意思。

三:小结

你也可以把CSS代码保存为一个css文件,放在header.php里面效果也是一样的,B站不好直接贴视频,应该是限制了外链,或许有什么更好的办法,希望能告诉我。

© 版权声明
THE END
文章不错?点个赞呗
点赞0 分享