【发布时间】:2017-03-13 06:41:41
【问题描述】:
我正在尝试将 Publish 的行为更改为 Apple New Wordpress plugin。我的主题使用自定义字段来嵌入视频,但插件无法识别该内容。我正在尝试将元数据附加到 Apple News 帖子的开头。这是我的代码不起作用:
function add_post_meta_content($content) {
$meta = get_post_meta( get_the_ID(), 'csco_post_embed', true );
return .$meta.$content;
}
add_filter('apple_news_exporter_content_pre', add_post_meta_content);
apply_filters( 'apple_news_exporter_content_pre', $post->post_content, $post->ID );
例如,如果我将代码更改为以下内容:
function add_post_meta_content($content) {
$meta = get_post_meta( get_the_ID(), 'csco_post_embed', true );
return 'Print this content before the post'.$meta.$content;
}
add_filter('apple_news_exporter_content_pre', add_post_meta_content);
apply_filters( 'apple_news_exporter_content_pre', $post->post_content, $post->ID );
它将“在帖子之前打印此内容”附加到帖子的开头而不会出现问题。我在这里想念什么?
【问题讨论】:
-
应该是
return $meta.$content;,$meta前面没有点。 -
我复制错了。在 $meta 之前没有运行带有点的代码。这是我为该代码运行的插件文档:github.com/alleyinteractive/apple-news/wiki/…