用于 WP 自定义字段的 Facebook Instant Articles
Facebook Instant Articles for WP custom fields
我正在尝试将自定义字段包含到 Facebook Instant Articles for WP plugin for Wordpress。
我使用的是 wordpress 版本 4.4.2 和 php-5.6.18.
自定义字段是粘贴youtube iframe代码的字段,用于嵌入文章。
任何人都可以提供如何在插件生成的输出中包含此自定义字段的提示或示例吗?
最终在插件的支持论坛中找到了解决方案here
use Facebook\InstantArticles\Elements\Video;
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) );
} );
我正在尝试将自定义字段包含到 Facebook Instant Articles for WP plugin for Wordpress。
我使用的是 wordpress 版本 4.4.2 和 php-5.6.18.
自定义字段是粘贴youtube iframe代码的字段,用于嵌入文章。
任何人都可以提供如何在插件生成的输出中包含此自定义字段的提示或示例吗?
最终在插件的支持论坛中找到了解决方案here
use Facebook\InstantArticles\Elements\Video;
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) );
} );