Created
September 24, 2012 11:56
-
-
Save roborourke/3775609 to your computer and use it in GitHub Desktop.
Replace default feed in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'use_alt_feed' ); | |
function use_alt_feed() { | |
if ( is_feed() && is_post_type_archive( 'my_post_type' ) ) { | |
$feed = get_default_feed(); | |
remove_action( 'do_feed_' . $feed, 'do_feed_' . $feed ); | |
add_action( 'do_feed_' . $feed, 'my_custom_feed' ); | |
} | |
} | |
function my_custom_feed() { | |
load_template( '/path/to/feed/template.php' ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment