Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Custom RSS Feed Cocktails and Recipes
- */
- $numposts = '100'; // number of posts displayed
- $length = '600'; // how many characters do you wish to include per post;
- function rss_text_limit($string, $length) {
- $string = strip_tags($string);
- $slength = strlen($string);
- if ($dlength >= $dch) {
- $dfoo1 = (substr("$string", 0, $length));
- $foo = "$dfoo1...";
- return $foo;
- }
- }
- query_posts(array(
- 'category__in' => array(3),
- 'feed' => 'rss2'
- ));
- 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><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
- <link><?php bloginfo_rss('url') ?></link>
- <description><?php bloginfo_rss("description") ?></description>
- <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
- <?php the_generator( 'rss2' ); ?>
- <language><?php echo get_option('rss_language'); ?></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 if(have_posts()): while(have_posts()): the_post(); ?>
- <item>
- <title><?php the_title(); ?></title>
- <link><?php the_permalink(); ?></link>
- <description><?php the_excerpt_rss(); ?></description>
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
- <guid><?php the_guid(); ?></guid>
- </item>
- <?php endwhile; endif; ?>
- </channel>
- </rss>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement