Using 2 modified feed templates.
-
I’ve been using an added function to load a modified rss template. Works fine, but now I need to add a custom template for a CPT.
I have code for each,which works ok, but can’t be used together because one over-rides the other.
I don’t know enough php to modify.
Here’s the code I’m using…
remove_all_actions( 'do_feed_rss2' ); add_action( 'do_feed_rss2', function() { if ( $rss_template = locate_template( '/feeds/notes-feed.php' ) ) load_template( $rss_template ); else do_feed_rss2(); // Call default function }, 10, 1 );and
remove_all_actions( 'do_feed_rss2' ); add_action( 'do_feed_rss2', 'item_feed_rss2', 10, 1 ); function item_feed_rss2() { $rss_template = get_template_directory() . '/feeds/item-feed.php'; if( get_query_var( 'post_type' ) == 'item' and file_exists( $rss_template ) ) load_template( $rss_template ); else do_feed_rss2(); // Call default function
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Using 2 modified feed templates.’ is closed to new replies.