This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Problems embedding local video using video tag

  • Creator
    Topic
  • #731
    bridge
    Member

    Hi,

    I was trying to embed a local video on my home page using layout builder and raw HTML. However, when I use the video tag, the theme seems to strip off the video tag. I can however, embed a YouTube video with an iframe tag.

    This is the code i am using:

    <video width="436" height="296" poster="/images/poster.jpg" controls="controls">
        <source src="/video/video.mp4" type="video/mp4" />
        <source src="/video/video.ogv" type="video/ogg" />
        Your browser doesn't support this video
    </video>

    How can I get this done – or what may be the problem?

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #741
    Jason Bobich
    Keymaster

    Hello,

    The reason is because the video and source tags aren’t part of WordPress’s global $allowedtags array. When the theme sanitizes the options before saving there are also some additional filters attached you can utilize. Here is an example of how you’d add in your tags from your Child theme’s functions.php:

    function my_allowed_tags( $tags ){
    	$tags['video'] = array(
    		'width'		=> array(),
    		'height'	=> array(),
    		'poster'	=> array(),
    		'controls'	=> array()
    	);
    	$tags['source'] = array(
    		'src'		=> array(),
    		'type'		=> array()
    	);
    	return $tags;
    }
    add_filter( 'themeblvd_allowed_tags', 'my_allowed_tags' );
Viewing 1 replies (of 1 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.