RSS Feed for Podcasts - WordPress Template

R
Published in: RSS - WordPress

You can use your WordPress blog to publish podcasts on iTunes. Most podcasters use FeedBurner to add iTunes specific author information to podcast XML feed but if you prefer to skip FeedBurner, use these feed template.

Create a new page in your WordPress dashboard and give it a custom slug (say podcast). Now create a page-podcast.php file in your WordPress themes folder and copy-paste the following code. Remember to replace information in the highlighted lines.

The permalink of that WordPress Page will become the URL of your Podcast feed which you can now publish to the iTunes Podcasting directory.

/* RSS Feed for iTunes Podcast  */
/* Source: www.labnol.org       */

<?php
  header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
  echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
?>

<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
    <channel>
        <title><? bloginfo_rss('name'); wp_title_rss(); ?></title>
        <link><? bloginfo_rss('url') ?></link>
        <language><? bloginfo_rss('language'); ?></language>
        <description><? bloginfo_rss('description') ?></description>
        <itunes:explicit>no</itunes:explicit>
        <itunes:owner>
            <itunes:email>amit@labnol.org</itunes:email>
            <itunes:name>Amit Agarwal</itunes:name>
        </itunes:owner>
        <itunes:author>Amit Agarwal</itunes:author>
        <itunes:image href="http://placehold.it/1400x1400" />
        <itunes:keywords>tech, computers, tutorials</itunes:keywords>
        <itunes:subtitle>Get the most out of your tech.</itunes:subtitle>
        <itunes:summary>Podcast hosted by Amit Agarwal.</itunes:summary>
        <itunes:category text="Technology">
            <itunes:category text="Software How-To" /></itunes:category>
        <itunes:category text="Education"></itunes:category>
        <copyright>Creative Commons License</copyright>
        <? $q = new WP_Query(array('posts_per_page'=>25,'tag'=>'podcast')); ?>
        <? while( $q->have_posts()) : $q->the_post(); ?>
            <item>
                <title><? the_title() ?></title>
                <link><? the_permalink() ?></link>
                <pubDate>
                    <?= mysql2date( 'D, d M Y H:i:s +0000',
                                get_post_time( 'Y-m-d H:i:s', true), false); ?>
                </pubDate>
                <guid isPermaLink="false">
                    <? the_guid(); ?>
                </guid>
                <description>
                    <![CDATA[<? the_excerpt(); ?>]]>
                </description>
                <itunes:explicit>no</itunes:explicit>
                <itunes:subtitle><? the_excerpt(); ?></itunes:subtitle>
                <itunes:summary><? the_excerpt(); ?></itunes:summary>
                <itunes:author>Amit Agarwal</itunes:author>
                <itunes:keywords>computers, tech, tutorials</itunes:keywords>
                <?php rss_enclosure(); ?>
            </item>
        <? endwhile; ?>
        <? wp_reset_postdata(); ?>
    </channel>
</rss>
📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: RSS - WordPress

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
A
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account
G

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube