Facebook Instant Articles for WP custom fields

I’m trying to include a custom field to the Facebook Instant Articles for WP plugin for WordPress.

I’m on wordpress version 4.4.2 and php-5.6.18.

Read More

The custom field is a field for pasting youtube iframe code, for embedding in articles.

Can anyone provide a hint or an example of how to include this custom field in the generated output of the plugin?

Related posts

1 comment

  1. Finally the solution was found in the plugin’s support forum here

    use FacebookInstantArticlesElementsVideo;
    
    add_action( 'instant_articles_after_transform_post', function ($ia_post) {
        $instant_article = $ia_post->instant_article;
        $post_id = $ia_post->get_the_id();
        $video_url = get_post_meta( $post_id, 'video_url', true );
        $instant_article->addChild( Video::create()->withURL($video_url) );
    } );
    

Comments are closed.