Support

Account

Home Forums Add-ons Flexible Content Field ACF Flexible Content + "Publish to Apple News" plugin

Unread

ACF Flexible Content + "Publish to Apple News" plugin

    • juxprose

    • November 29, 2018 at 12:37 am

    This is the Publish to Apple News plugin, which is Apple’s recommended way to publish WordPress posts to Apple News.

    The plugin works, in that it publishes Posts to Apple News, but there is no body content included when the article is published.

    This is because I am using a Flexible Content field to create a WordPress Post, so there is no the_content() for Apple news to grab.

    The plugin developer has posted a function demonstrating how to use a filter to grab ACF custom fields to pass to Apple News, see here: https://github.com/alleyinteractive/apple-news/issues/354.

    function add_content_to_apple_news($content, $ID) {
    
     $post = get_post($ID);
    
     //For podcasts custom post_type add in the teaser and the sponsors.
     if($post->post_type == 'podcasts' ) {
      $teaser = get_field('podcast_teaser', $ID, false);  //get data from ACF field
      $sponsors = get_field('podcast_sponsors', $ID, false);  //get data from ACF field
    
      $content = $teaser . $content . $sponsors;
     }
    
      return $content;
    }
    add_filter( 'apple_news_exporter_content_pre', 'add_content_to_apple_news', 10, 2 );

    This is a basic example, but my Flexible Content requires more configuration within the function, which is where I am looking for help.

    To keep things simple, let’s say I have a Flexible Content block called “Content”, which will appear multiple times within a Post. This is the ACF field I am looking to push to Apple News, via the function.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.