iframe插入视频,点击按钮播放

<iframe src="https://www.youtube.com/embed/gc9oMqXZXGM?enablejsapi=1&version=3&playerapiid=ytplayer" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<script>
$('.button').on('click',function(){
$('.parentbox').find('iframe')[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
})
</script>

添加经典样式编辑器

add_meta_box('metabox5','Gallary','box_callback',array(''),'normal');

function box_callback($post){
    wp_nonce_field('box5_nonceaction','box5_noncename');
   $value = get_post_meta( $post->ID, '_box5_value_key', true );
     wp_editor( htmlspecialchars_decode($value),  $editor_id, $settings = array(
       'quicktags'=> 0,
        'tinymce'=>0,
        'textarea_rows'=>4,
        'editor_class'=>"textareastyle"
)); }
$post_ID = $_POST['post_ID'];
$mydata = $_POST[ $editor_id];
update_post_meta($post_ID,'_box5_value_key',$mydata);

判断滚动位置

function animateContent() {
        var $object = $("a,b,c");
       $object.each(function () {
        var $this = $(this);
        if ($this.length) {
            var $a = $(this).offset().top;
            var $b = $(window).scrollTop();
            var $c = $(window).height() * 0.75;
            var $d = $(window).height();
            var $selfHeight = $(this).height();
            if (($b > ($a - $c)) || ($b > ($a - $d + $selfHeight))) {
                $this.addClass("animate");
            }
        }
    });
    }