Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: [wp-hackers] Custom feeds: Full and summary

I was bored... this works:

<?php
/*
Plugin Name: Feed Type Override
Description: Allows you to pass ?feedtype=full or ?feedtype=excerpt to feed URIs to force full or excerpted feeds. Without a feedtype designated, it uses your default setting.
Author: Mark Jaquith
Author URI: http://txfx.net/
*/


function txfx_feedtype_override($option) {
	if ( $_GET['feedtype'] == 'full' )
		return false;
	if ( $_GET['feedtype'] == 'excerpt' )
		return true;
	return $option;
}
add_filter('option_rss_use_excerpt', 'txfx_feedtype_override');
?>




On Dec 21, 2005, at 5:53 AM, Choan C. Gálvez wrote:

Roy Schestowitz wrote:
_____/ On Wed 21 Dec 2005 10:05:32 GMT, [Chetan Kunte] wrote : \_____
I'm looking at something like this in theory, when the blog owner
provides full post in feed by default:

http://somesite.com/?feed=rss2&type=summary
http://somesite.com/?feed=rss2&type=full

Does such a thing exist natively in WordPress?
--
Looking at the latest version,
===
<?php if (get_settings('rss_use_excerpt')) : ?>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></ description>
<?php else : ?>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></ description>
<?php if ( strlen( $post->post_content ) > 0 ) : ?>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]] ></content:encoded>
<?php else : ?>
<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></ content:encoded>
<?php endif; ?>
<?php endif; ?>
===
You could change the file and save it as rss-excerpt.php. As far as I can
tell, you could not (trivially) pass it an argument to bubble through to
the conditional statements. It requires changing the interfaces. It would
be nice, I agree. I have about 5 separate files for feeds, which leads to
fragmentations and leaks. Choice is good nonetheless. 1/3 of the sub-
scribers prefer full text and the rest settle for a one-line excerpt.

Well, inside function `get_settings` the return value is filtered:

	return apply_filters('option_' . $setting, $option);

So the `rss_use_excerpt` value could easily be modified by a plugin.

Regards,
Choan
_______________________________________________
wp-hackers mailing list
wp-hackers@xxxxxxxxxxxxxxxxxxxx
http://lists.automattic.com/mailman/listinfo/wp-hackers



-- Mark Jaquith http://txfx.net/


_______________________________________________ wp-hackers mailing list wp-hackers@xxxxxxxxxxxxxxxxxxxx http://lists.automattic.com/mailman/listinfo/wp-hackers

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index