Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Template Name: RSS Gallery
$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"
<?php do_action('rss2_ns'); ?>>
<title>CSS-Tricks Gallery RSS Feed</title>
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
<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>
<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'); ?>
while ( $query->have_posts() ) :
<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>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo get_post_meta($post->ID, 'screenshot', true); ?>" alt="<?php the_title(); ?>">
<?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 } ?>
<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'); ?>
<?php endwhile; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.