admin管理员组文章数量:1318765
Very much a newbie here, but I'm trying to use this idea to disable forward seeking in Vimeo clips embedded on a Wordpress site
To my functions.php I've added
function frogaloop_scripts() {
wp_register_script('snippet', 'https://siteurl/wp-content/themes/themename/js/snippet.js');
wp_register_script('frogaloop','.min.js');
}
add_action( 'wp_enqueue_scripts', 'frogaloop_scripts' );
On a page with an embedded video, I've got
<iframe id="video1" src=";player_id=video1" width="630" height="354" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
Where 'video1' matches the iframe label in the codepen example.
When I load the page source, I can't even see frogaloop being listed, so I'm not sure the enqueuing is even happening...
Where am I going wrong with this ?
Very much a newbie here, but I'm trying to use this idea to disable forward seeking in Vimeo clips embedded on a Wordpress site
To my functions.php I've added
function frogaloop_scripts() {
wp_register_script('snippet', 'https://siteurl/wp-content/themes/themename/js/snippet.js');
wp_register_script('frogaloop','https://f.vimeocdn/js/froogaloop2.min.js');
}
add_action( 'wp_enqueue_scripts', 'frogaloop_scripts' );
On a page with an embedded video, I've got
<iframe id="video1" src="https://player.vimeo/video/xxxxx?api=1&player_id=video1" width="630" height="354" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
Where 'video1' matches the iframe label in the codepen example.
When I load the page source, I can't even see frogaloop being listed, so I'm not sure the enqueuing is even happening...
Where am I going wrong with this ?
Share Improve this question edited Oct 20, 2020 at 11:04 mcrsam asked Oct 19, 2020 at 23:08 mcrsammcrsam 133 bronze badges1 Answer
Reset to default 2so I'm not sure the enqueuing is even happening
No, it's not, because you only registered the scripts, but never enqueued them — which should be done using wp_enqueue_script()
.
Also, you should make frogaloop
as a dependency for your snippet.js
script. Hence, register the frogaloop
script before your snippet.js
script.
// Register the scripts.
wp_register_script( 'frogaloop', 'https://f.vimeocdn/js/froogaloop2.min.js', array(), null );
// The third parameter is the script dependencies.
wp_register_script( 'snippet', get_template_directory_uri() . '/js/snippet.js', array( 'frogaloop' ) );
// Then enqueue them. But you just need to call:
wp_enqueue_script( 'snippet' );
// because frogaloop will also be enqueued because it's a dependency for your
// snippet.js script.
Now that should work.
本文标签: javascriptVimeo froogaloop
版权声明:本文标题:javascript - Vimeo froogaloop 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742048727a2417946.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论