There’s an add_feed()
function. You pass it a function via the second callback parameter. So something like this should work:
add_action( 'init', 'wpse102646_all_items_feed' );
function wpse102646_all_items_feed() {
add_feed( 'allposts', 'wpse102646_get_all_items' );
}
function wpse102646_get_all_items() {
$args = array(
'numberposts' => -1,
'post_type' => 'post',
'post_status' => 'publish',
);
$posts = get_posts( $args );
$feed = '';
global $post;
foreach( $posts as $post ) {
$feed .= get_the_title();
$feed .= get_the_content();
}
return $feed;
}
This code is untested.
Also, I’m not entirely sure if return $feed;
is what’s required by add_feed()
, or if you should instead echo( $feed );
. I suspect the former.
Additionally, any time you change your add_feed()
code, you’ll need to flush the permalinks. The recommended way is to go to Settings » Permalinks and Save your existing permalink structure.
Reference
Codex: