khristoff
khristoff

Reputation: 25

Wordpress Facebook Instant Articles not working

I'm trying to install the wordpress plugin "Instant Articles for WP" (https://es.wordpress.org/plugins/fb-instant-articles/), I finish the process but when I get to the point to send 5 articles to review for FB the plugin show me to check all(5) the posts to solve the warnings on it, I tried to edit the post but the box that contain the Instant Articles is loading and does not solve anything, in the Chrome console I get "Uncaught ReferenceError: instant_articles_load_meta_box is not defined". I tried to move the jquery declaration to the top but the error persists. Any ideas? ):

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>

Upvotes: 0

Views: 886

Answers (1)

khristoff
khristoff

Reputation: 25

SOLVED: Just replacing this on meta-box-loader-template.php:

<script>
    instant_articles_load_meta_box( <?php echo absint( $post->ID ); ?> );
</script>

With this:

<script>
    jQuery.noConflict();
    jQuery( document ).ready(function( $ ) {
        instant_articles_load_meta_box( <?php echo absint( $post->ID ); ?> );
    });
</script>

Upvotes: 0

Related Questions