Advertisement
Guest User

Untitled

a guest
Jul 21st, 2010
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Custom RSS Feed Cocktails and Recipes
  4. */
  5.  
  6. $numposts = '100'; // number of posts displayed
  7. $length = '600';  // how many characters do you wish to include per post;
  8.  
  9. function rss_text_limit($string, $length) {
  10.   $string = strip_tags($string);
  11.   $slength = strlen($string);
  12.   if ($dlength >= $dch) {
  13.     $dfoo1 = (substr("$string", 0, $length));
  14.     $foo = "$dfoo1...";
  15.     return $foo;
  16.   }
  17. }
  18.  
  19. query_posts(array(
  20.   'category__in' => array(3),
  21.   'feed' => 'rss2'
  22. ));
  23.  
  24.  
  25. header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
  26. echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
  27. <rss version="2.0"
  28.  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  29.  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  30.  xmlns:dc="http://purl.org/dc/elements/1.1/"
  31.  xmlns:atom="http://www.w3.org/2005/Atom"
  32.  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  33.  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  34.  <?php do_action('rss2_ns'); ?>
  35. >
  36. <channel>
  37.  <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
  38.  <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
  39.  <link><?php bloginfo_rss('url') ?></link>
  40.  <description><?php bloginfo_rss("description") ?></description>
  41.  <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
  42.  <?php the_generator( 'rss2' ); ?>
  43.  <language><?php echo get_option('rss_language'); ?></language>
  44.  <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
  45.  <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
  46.  
  47. <?php if(have_posts()): while(have_posts()): the_post(); ?>
  48.  <item>
  49.    <title><?php the_title(); ?></title>
  50.    <link><?php the_permalink(); ?></link>
  51. <description><?php the_excerpt_rss(); ?></description>
  52.    <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
  53.    <guid><?php the_guid(); ?></guid>
  54.  </item>
  55. <?php endwhile; endif; ?>
  56. </channel>
  57. </rss>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement