Created
August 29, 2012 19:50
-
-
Save billrobbins/3517908 to your computer and use it in GitHub Desktop.
Custom Podcast Feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Custom Feed | |
* | |
* | |
* @package WordPress | |
* @subpackage organizedthemes | |
* @since 1.1.0 | |
* | |
*/ | |
function yoast_rss_date( $timestamp = null ) { | |
$timestamp = ($timestamp==null) ? time() : $timestamp; | |
echo date(DATE_RSS, $timestamp); | |
} | |
header("Content-Type: application/rss+xml; charset=UTF-8"); | |
echo '<?xml version="1.0" encoding="UTF-8"?>'; | |
?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> | |
<channel> | |
<title><?php echo of_get_option('podcast_title'); ?></title> | |
<link><?php echo of_get_option('podcast_url'); ?></link> | |
<language>en-us</language> | |
<copyright>℗ & © <?php the_time('Y'); ?> <?php bloginfo('name'); ?></copyright> | |
<itunes:subtitle><?php echo of_get_option('podcast_subtitle'); ?></itunes:subtitle> | |
<itunes:author><?php echo of_get_option('podcast_author'); ?></itunes:author> | |
<itunes:summary><?php echo of_get_option('podcast_summary'); ?></itunes:summary> | |
<description><?php echo of_get_option('podcast_summary'); ?></description> | |
<itunes:owner> | |
<itunes:name><?php echo of_get_option('podcast_owner'); ?></itunes:name> | |
<itunes:email><?php echo of_get_option('podcast_email'); ?></itunes:email> | |
</itunes:owner> | |
<itunes:image href="<?php echo of_get_option('podcast_art'); ?>" /> | |
<itunes:category text="<?php echo of_get_option('podcast_category'); ?>"> | |
<itunes:category text="<?php echo of_get_option('podcast_subcategory'); ?>"/> | |
</itunes:category> | |
<?php $recent = new WP_Query("post_type=podcast&showposts=20"); while($recent->have_posts()) : $recent->the_post(); ?> | |
<item> | |
<title><?php echo get_the_title($post->ID); ?></title> | |
<itunes:author><?php | |
$terms_as_text = get_the_term_list( $post->ID, 'speaker', '', ', ', '' ) ; | |
echo strip_tags($terms_as_text); | |
?></itunes:author> | |
<itunes:subtitle></itunes:subtitle> | |
<itunes:summary><?php the_excerpt_rss(); ?></itunes:summary> | |
<itunes:image href="<?php echo of_get_option('podcast_art'); ?>" /> | |
<enclosure url="<?php echo get_post_meta($post->ID, "message_audio", TRUE); ?>" length="43397038" type="audio/mpeg" /> | |
<guid><?php echo get_post_meta($post->ID, "message_audio", TRUE); ?></guid> | |
<pubDate><?php yoast_rss_date( strtotime($post->post_date_gmt) ); ?></pubDate> | |
<itunes:duration><?php echo get_post_meta($post->ID, "duration", TRUE); ?></itunes:duration> | |
<itunes:keywords></itunes:keywords> | |
</item> | |
<?php endwhile; ?> | |
</channel> | |
</rss> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment