Added rss_use_excerpt flag

git-svn-id: https://develop.svn.wordpress.org/trunk@18 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mike Little 2003-05-06 22:16:07 +00:00
parent fb10a6c04c
commit 4ee3e0d116
4 changed files with 47 additions and 19 deletions

View File

@ -154,7 +154,8 @@ $rss_encoded_html = 0;
# length (in words) of excerpts in the RSS feed? 0=unlimited # length (in words) of excerpts in the RSS feed? 0=unlimited
# note: in b2rss.php, this will be set to 0 if you use encoded HTML # note: in b2rss.php, this will be set to 0 if you use encoded HTML
$rss_excerpt_length = 50; $rss_excerpt_length = 50;
#use the excerpt field for rss feed.
$rss_use_excerpt = 1;
// ** Weblogs.com ping ** // ** Weblogs.com ping **

View File

@ -45,7 +45,16 @@ if (!isset($rss_language)) { $rss_language = 'en'; }
<dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date> <dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date>
<dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator> <dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
<dc:subject><?php the_category_rss() ?></dc:subject> <dc:subject><?php the_category_rss() ?></dc:subject>
<?php if ($rss_use_excerpt) {
?>
<description><?php the_excerpt_rss($rss_excerpt_length, 2) ?></description>
<?php
} else { // use content
?>
<description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description> <description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
<?php
} // end else use content
?>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded> <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
</item> </item>
<?php } ?> <?php } ?>

View File

@ -21,14 +21,23 @@ if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_leng
<?php $items_count = 0; while($row = mysql_fetch_object($result)) { start_b2(); ?> <?php $items_count = 0; while($row = mysql_fetch_object($result)) { start_b2(); ?>
<item> <item>
<title><?php the_title_rss() ?></title><?php <title><?php the_title_rss() ?></title>
<?php
// we might use this in the future, but not now, that's why it's commented in PHP // we might use this in the future, but not now, that's why it's commented in PHP
// so that it doesn't appear at all in the RSS // so that it doesn't appear at all in the RSS
// echo "<category>"; the_category_unicode(); echo "</category>"; ?> // echo "<category>"; the_category_unicode(); echo "</category>";
if ($rss_use_excerpt) {
?>
<description><?php the_excerpt_rss($rss_excerpt_length, $rss_encoded_html) ?></description>
<?php
} else { // use content
?>
<description><?php the_content_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?></description> <description><?php the_content_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?></description>
<?php
} // end else use content
?>
<link><?php permalink_single_rss() ?></link> <link><?php permalink_single_rss() ?></link>
</item> </item>
<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?> <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?>
</channel> </channel>
</rss> </rss>

View File

@ -37,7 +37,16 @@ if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_leng
<dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator> <dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
<dc:subject><?php the_category_rss() ?></dc:subject> <dc:subject><?php the_category_rss() ?></dc:subject>
<guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid> <guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid>
<?php if ($rss_use_excerpt) {
?>
<description><?php the_excerpt_rss($rss_excerpt_length, 2) ?></description>
<?php
} else { // use content
?>
<description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description> <description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
<?php
} // end else use content
?>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded> <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
</item> </item>
<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?> <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?>