Populate subtitle with custom post meta
-
Hi there, I need to change the subtitle with some custom post meta, trying two different approaches but nothing happens when I update the post…
First I tried this:
add_action( ‘instant_articles_after_transform_post’, function ($ia_post) {
$instant_article = $ia_post->instant_article;
$subtitle = get_post_meta($ia_post->get_the_id(), ‘subtitle’, true);
$instant_article->withHeader(
Header::create()
->withSubTitle($subtitle)
);
} );With this code, the IA is generated without head, I guess it means this breaks it. Then I tried this one:
function change_ia_subtitle( $subtitle, $this ) {
$subtitle = get_post_meta($this->get_the_id(), ‘subtitulo’, true);
return $subtitle;
}
add_filter( ‘instant_articles_subtitle’, ‘change_ia_subtitle’, 10, 2 );But nothing happens… Any clue?
- The topic ‘Populate subtitle with custom post meta’ is closed to new replies.