WordPress Custom RSS with ACF Pro not displaying in Apple News Publisher

I am having issues in WordPress with a custom RSS feed that uses ACF Pro plugin for content. It works in several RSS feed readers like Feedly which is great, but we can’t get it to display is the apple News Publisher app.

The feed validates.

Read More

Here is the url structure:
http://www.websitename.com/category/category-name/feed

Here is the code.

//Add to functions.php for custom feed

add_action('init', 'customMagfeed');
function customMagfeed() {
        add_feed('magfeed', 'customMagFeedFunc');
}
function customMagFeedFunc() {
        get_template_part('rss', 'magfeed');
}

//RSS Feed code

header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
?>
<rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
        <?php do_action('rss2_ns'); ?>>
<channel>
        <title><?php bloginfo_rss('name'); ?></title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss('description') ?></description>
        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
        <language>en-us</language>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
        <?php do_action('rss2_head'); ?>
        <?php while(have_posts()) : the_post(); ?>

                <item>
                        <title><?php the_title_rss(); ?></title>
                        <link><?php the_permalink_rss(); ?></link>
                        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
                        <dc:creator><?php the_author(); ?></dc:creator>
                        <guid isPermaLink="false"><?php the_guid(); ?></guid>
                        <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
                                                <content:encoded><![CDATA[<?php $authors = get_field('authors');
                            $photographers = get_field('photographers');
                            $article_share_image_obj = get_field('poster_image');
                            $article_share_image = $article_share_image_obj['url'];
                            if ($article_share_image_obj) :
                              echo '<img src="'.$article_share_image.'"/><br>';
                            endif;
                            if ($authors) :
                                            echo '<span>Written by ';
                                            $i = 0;
                                            foreach ($authors as $post) {
                                                $i++;
                                                if ($i === count($authors)) {
                                                    echo '<a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a>';
                                                } else {
                                                    echo '<a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a> &amp; ';
                                                }
                                            }
                                            wp_reset_postdata();
                                            echo '</span><br>';
                                        endif;
                            if ($photographers) :
                                            echo '<span class="photographer-byline">Photography by ';
                                            $i = 0;
                                            foreach ($photographers as $post) {
                                                $i++;
                                                if ($i === (count($photographers))) {
                                                    echo '<a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a>';
                                                } else {
                                                    echo '<a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a> &amp; ';
                                                }
                                            }
                                            wp_reset_postdata();
                                            echo '</span><br><br>';
                                        endif;
                                if (have_rows('article_content')) :
                                    while (have_rows('article_content')) : the_row();
                                        if (get_row_layout() == 'lead_text') :

                                //Lead Text start
                                              the_sub_field('text');
                                //Lead text start

                                        elseif (get_row_layout() == 'column_content') :

                                //Column content start
                                    $sidebar = get_sub_field('sidebar');
                                    if ($sidebar === 'sidebar-on-left') :
                                        if (have_rows('left_sidebar')) : while (have_rows('left_sidebar')) : the_row();
                                      //Sidebar builder
                                      $layout = get_row_layout();
                                        if ($layout === 'image') :
                                                $image = get_sub_field('image');
                                                $image_url = $image['sizes']['thumbnail-size'];
                                                $image_url_zoom = $image['sizes']['sidebar-size'];
                                                $caption = get_sub_field('caption');
                                                echo '<a href="'.$image_url_zoom.'" title="'.$caption.'">';
                                                echo '<img src="'.$image_url.'" alt="'.$caption.'"/></a>';
                                                echo $caption;
                                        endif;
                                      //End Sidebar Builder
                                        endwhile; endif;
                                        the_sub_field('content');
                                    elseif ($sidebar === 'sidebar-on-right') :
                                        the_sub_field('content');
                                        if (have_rows('right_sidebar')) : while (have_rows('right_sidebar')) : the_row();
                                      ///Sidebar builder
                                      $layout = get_row_layout();
                                        if ($layout === 'image') :
                                                $image = get_sub_field('image');
                                                $image_url = $image['sizes']['thumbnail-size'];
                                                $image_url_zoom = $image['sizes']['sidebar-size'];
                                                $caption = get_sub_field('caption');
                                                echo '<a href="'.$image_url_zoom.'" class="sidebar-image-wrap fancybox" title="'.$caption.'">';
                                                echo '<img src="'.$image_url.'" alt="'.$caption.'"/></a>';
                                                echo $caption;
                                        endif;
                                      //End Sidebar Builder
                                        endwhile; endif;
                                    elseif ($sidebar === 'sidebar-both') :
                                        if (have_rows('left_sidebar')) : while (have_rows('left_sidebar')) : the_row();
                                      //Sidebar builder
                                      $layout = get_row_layout();
                                        if ($layout === 'image') :
                                                $image = get_sub_field('image');
                                                $image_url = $image['sizes']['thumbnail-size'];
                                                $image_url_zoom = $image['sizes']['sidebar-size'];
                                                $caption = get_sub_field('caption');
                                                echo '<a href="'.$image_url_zoom.'" class="sidebar-image-wrap fancybox" title="'.$caption.'">';
                                                echo '<img src="'.$image_url.'" alt="'.$caption.'"/></a>';
                                                echo $caption;
                                        endif;
                                      //End Sidebar Builder
                                        endwhile; endif;
                                          the_sub_field('content');
                                        if (have_rows('right_sidebar')) : while (have_rows('right_sidebar')) : the_row();
                                      //Sidebar builder
                                      $layout = get_row_layout();
                                        if ($layout === 'image') :
                                                $image = get_sub_field('image');
                                                $image_url = $image['sizes']['thumbnail-size'];
                                                $image_url_zoom = $image['sizes']['sidebar-size'];
                                                $caption = get_sub_field('caption');
                                                echo '<a href="'.$image_url_zoom.'" class="sidebar-image-wrap fancybox" title="'.$caption.'">';
                                                echo '<img src="'.$image_url.'" alt="'.$caption.'"/></a>';
                                                echo $caption;
                                        endif;
                                      //End Sidebar Builder
                                        endwhile; endif;
                                    else :
                                        the_sub_field('content');
                                    endif;
                                //Column content end

                                        elseif (get_row_layout() == 'wide_photo_gallery') :

                                //Wide Photo Gallery start
                                    if (have_rows('photos')) : while (have_rows('photos')) : the_row();
                                        $gallery_photo = get_sub_field('photo');
                                        $gallery_photo_caption = $gallery_photo['caption'];
                                        $gallery_photo_url = $gallery_photo['sizes']['gallery-wide-large'];
                                        echo '<img src="'.$gallery_photo_url.'"/>';
                                    endwhile; endif;
                                //Wide Photo Gallery end

                                        elseif (get_row_layout() == 'photo_grid_builder') :

                                //Photo Grid builder start
                                  if (have_rows('photos')) : while (have_rows('photos')) : the_row();
                                     $photo_size = get_sub_field('photo_size');
                                     if ($photo_size === 'break') :
                                     else :
                                          $photo = get_sub_field('photo');
                                        $photo_url = $photo['url'];
                                            echo '<img src="'.$photo_url.'" class="background"/>';
                                             if (get_sub_field('photo_subtitle') || get_sub_field('photo_caption')) :
                                                         if (get_sub_field('photo_subtitle')) :
                                                             the_sub_field('photo_subtitle');
                                                         endif;
                                                         if (get_sub_field('photo_caption')) :
                                                                the_sub_field('photo_subtitle');
                                                             if (get_sub_field('photo_link')) {
                                                   echo '<a href="'.get_sub_field('photo_link').'">Photo Link</a>';
                                                 }
                                                         endif;
                                             endif;
                                      endif;
                                   endwhile; endif;
                                //Photo Grid builder end

                                        elseif (get_row_layout() == 'blockquote') :

                                //Blockquote start
                                    the_sub_field('quote_text');
                                            if (get_sub_field('quote_author')) :
                                                the_sub_field('quote_author');
                                            endif;
                                //Blockquote end

                                        elseif (get_row_layout() == 'video') :

                                //Video start
                                    $video_poster_obj = get_sub_field('poster_image');
                                    $video_poster_url = $video_poster_obj['sizes']['background-image-size'];
                                    echo '<a href="'.get_sub_field('video_url').'">Click here to watch the video</a><br>';
                                    echo the_sub_field('video_title').'<br>';
                                    echo the_sub_field('video_caption').'<br>';
                                //Video end

                                        elseif (get_row_layout() == 'layered_photo_gallery') :

                                //Layered gallery start
                                    $bg_img_obj = get_sub_field('background_image');
                                    $bg_img_url = $bg_img_obj['url'];
                                    if (get_sub_field('element_title') != '') {
                                            get_sub_field('element_title');
                                    }
                                    if (get_sub_field('element_description') != '') {
                                            get_sub_field('element_description');
                                    }
                                    if (have_rows('slides')) : while (have_rows('slides')) : the_row();
                                            $gallery_photo = get_sub_field('image');
                                            $gallery_photo_url = $gallery_photo['sizes']['gallery-wide-large'];
                                        echo '<img src="'.$gallery_photo_url.'"/>';
                                            if (get_sub_field('slide_title')) {
                                                get_sub_field('slide_title');
                                            }
                                            if (get_sub_field('slide_description')) {
                                                get_sub_field('slide_description');
                                            }
                                    endwhile; endif;
                                //Layered gallery end

                                        endif;
                                    endwhile;
                                endif; ?>]]></content:encoded>
                        <?php rss_enclosure(); ?>
                        <?php do_action('rss2_item'); ?>
                </item>
        <?php endwhile; ?>
</channel>
</rss>

Related posts