我试图安装wordpress插件"即时文章用于WP" (https://es.wordpress.org/plugins/fb-instant-articles/),我完成了这个过程但是当我到达点发送5篇文章来审查FB时,插件显示我检查所有(5)帖子以解决它上面的警告,我试图编辑邮件,但包含即时文章的框正在加载,并没有解决任何问题,在Chrome控制台我得到"未捕获的ReferenceError:instant_articles_load_meta_box未定义"。我试图将jquery声明移到顶部,但错误仍然存在。有任何想法吗? ):
即时物品 - 间box.js
function instant_articles_force_submit ( post_ID ) {
var data = {
'action': 'instant_articles_force_submit',
'post_ID': post_ID,
'force': jQuery( '#instant_articles_force_submit' ).is( ':checked' ),
'security': jQuery( '#instant_articles_force_submit' ).attr( 'data-security' )
};
jQuery.post( ajaxurl, data, function(response) {
instant_articles_load_meta_box( post_ID );
});
}
function instant_articles_load_meta_box ( post_ID ) {
jQuery( document ).ready( function( $ ) {
var data = {
'action': 'instant_articles_meta_box',
'post_ID': post_ID
};
jQuery.post( ajaxurl, data, function(response) {
jQuery( '#instant_article_meta_box .inside' ).html( response );
jQuery( '#instant_articles_force_submit').click( function () {
instant_articles_force_submit( post_ID );
} );
}, 'html' );
jQuery( '#instant_article_meta_box' ).delegate( '.instant-articles-toggle-debug', 'click', function () {
jQuery( '#instant_article_meta_box' ).toggleClass( 'instant-articles-show-debug' );
return false;
} );
});
}
元盒架的template.php
<span class="instant_articles_spinner" ></span>
<script>
instant_articles_load_meta_box( <?php echo absint( $post->ID ); ?> );
</script>
答案 0 :(得分:0)
已解决:只需在meta-box-loader-template.php上替换它:
<script>
instant_articles_load_meta_box( <?php echo absint( $post->ID ); ?> );
</script>
有了这个:
<script>
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
instant_articles_load_meta_box( <?php echo absint( $post->ID ); ?> );
});
</script>