public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
<?php
/*
Template Name: RSS Gallery
*/
 
the_post();
 
$args = array(
'post_type' => 'screenshot',
'posts_per_page' => 10,
);
 
$query = new WP_Query($args);
 
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>CSS-Tricks Gallery RSS Feed</title>
 
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
 
<link>http://css-tricks.com/gallery/</link>
 
<description>The RSS feed for the gallery at CSS-Tricks. Screenshots taken of interesting, effective, and aesthetic design on the web.</description>
 
<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
 
<language>en-USd</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 ( $query->have_posts() ) :
 
$query->the_post();
?>
 
<item>
<title><?php the_title_rss(); ?></title>
<link><?php the_permalink_rss(); ?></link>
<comments><?php comments_link(); ?></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>
 
<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
 
<content:encoded><![CDATA[
 
<figure>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo get_post_meta($post->ID, 'screenshot', true); ?>" alt="<?php the_title(); ?>">
</a>
</figure>
 
<?php the_content(); ?>
 
<?php if (get_post_meta($post->ID, 'screenshot-link', true)) { ?>
<p><a href="<?php echo get_post_meta($post->ID, 'screenshot-link', true); ?>" class="button">Go To There &rarr;</a></p>
<?php } ?>
 
]]></content:encoded>
 
<wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
<slash:comments><?php echo get_comments_number(); ?></slash:comments>
 
<?php rss_enclosure(); ?>
<?php do_action('rss2_item'); ?>
 
</item>
 
<?php endwhile; ?>
 
</channel>
 
</rss>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.