admin管理员组文章数量:1277267
I'm trying to embed a video file (from Media Library) in a comment.
Adding the default code currently used in Posts didn't work:
[video width="1280" height="718" mp4=".mp4"][/video]
Pasting the raw link in the comment dind't work either, and the output was in plain text:
[video src=".mp4" /]
Is there a way to make Wordpress parse the comments in a way that I can use either the video shortcode or the raw link? I'm asking for help because I don't want to use a plugin for this. Thanks.
I'm trying to embed a video file (from Media Library) in a comment.
Adding the default code currently used in Posts didn't work:
[video width="1280" height="718" mp4="https://www.example/wp-content/uploads/2021/10/video.mp4"][/video]
Pasting the raw link in the comment dind't work either, and the output was in plain text:
[video src="https://www.example/wp-content/uploads/2021/10/video.mp4" /]
Is there a way to make Wordpress parse the comments in a way that I can use either the video shortcode or the raw link? I'm asking for help because I don't want to use a plugin for this. Thanks.
Share Improve this question edited Oct 16, 2021 at 21:42 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Oct 16, 2021 at 21:39 Mr. FontasticMr. Fontastic 1454 bronze badges 01 Answer
Reset to default 0Yea, you can't use short codes in comments by default with WordPress. Short codes are anything surrounded in those '[ ]' brackets. There are plugins you can install that allow you to use short-codes in posts, products, categories, and other places in WordPress that you aren't able to by default. However, I don't know of any that will allow you to put short-codes inside of comments fields since those fields are usually reserved for users to fill out.
There is a way to add your own PHP code to functions.php to add this ability as explained in this article: https://www.isitwp/add-shortcode-support-to-comments/
The other option would be to try using the HTML5 tag for videos, . Which would look something like:
<video controls width="250">
<source src="/uploads/flower.webm" type="video/webm">
<source src="/uploads/flower.mp4" type="video/mp4">
<source src="/uploads/flower.ogg" type="video/ogg">
</video>
Although, with the tag option, you may run into compatibility issues with different browsers & Operating Systems. If you do decide to try this option, just make sure that you include a few different video formats like the 3 I included (mp4, webm, & ogg) to increase the chances the video will be compatible and viewable for most people.
本文标签: embedEmbedding local video in Wordpress comments
版权声明:本文标题:embed - Embedding local video in Wordpress comments 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741266553a2368579.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论