Customizing RSS Feed
-
Currently, my wordpress blog RSS only syndicates Title, Permalink and comments (the default fields in ‘feed-rss2.php’):
<item> <title><?php the_title_rss() ?></title> <link><?php the_permalink_rss() ?></link> <comments><?php comments_link_feed(); ?></comments> <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> <?php the_category_rss() ?> <guid isPermaLink="false"><?php the_guid(); ?></guid> <?php if (get_option('rss_use_excerpt')) : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> <?php else : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> <?php if ( strlen( $post->post_content ) > 0 ) : ?> <content:encoded><![CDATA[<?php the_content_feed('rss2') ?>]]></content:encoded> <?php else : ?> <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded> <?php endif; ?> <?php endif; ?> <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss> <slash:comments><?php echo get_comments_number(); ?></slash:comments> <?php rss_enclosure(); ?> <?php do_action('rss2_item'); ?> </item>
I want my feed to sydicate title, link, tags, excerpt, custom field (image) and category. Based on Codex, it seems I would simply add the templates provided (https://codex.www.ads-software.com/Customizing_Feeds). But this doesn’t seem to change anything
<item> <title><?php the_title_rss() ?></title> <link><?php the_permalink_rss() ?></link> <tags><?php the_tags_rss(); ?></tags> <image><?php the_image_rss(); ?></image> <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> <?php the_category_rss() ?> <guid isPermaLink="false"><?php the_guid(); ?></guid> <?php if (get_option('rss_use_excerpt')) : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> <?php else : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> <?php if ( strlen( $post->post_content ) > 0 ) : ?> <content:encoded><![CDATA[<?php the_content_feed('rss2') ?>]]></content:encoded> <?php else : ?> <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded> <?php endif; ?> <?php endif; ?> <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss> <slash:comments><?php echo get_comments_number(); ?></slash:comments> <?php rss_enclosure(); ?> <?php do_action('rss2_item'); ?> </item>
What am I doing wrong?
- The topic ‘Customizing RSS Feed’ is closed to new replies.