我试图安装wordpress插件“即时WP文章”(https://es.wordpress.org/plugins/fb-instant-articles/),我完成了这个过程,但是当我到达发送5篇文章为FB提供评论时,插件告诉我检查所有的帖子来解决它上的警告,我试着编辑帖子,但是包含即时文章的框正在加载,没有解决任何问题,在Chrome控制台我得到了“未定义的ReferenceError: instant_articles_load_meta_box未定义”。我试图将jquery声明移到顶部,但错误仍然存在。(有什么想法吗?)
instant-articles-meta-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;
} );
});
}meta-box-loader-template.php
<span class="instant_articles_spinner" ></span>
<script>
instant_articles_load_meta_box( <?php echo absint( $post->ID ); ?> );
</script>发布于 2017-04-18 03:59:46
解决方案:只需在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>https://stackoverflow.com/questions/43455286
复制相似问题