The Feed templates are located in the /wp-includes/feed-{type}.php files and include formats for rdf, rss, rss2 and atom. 这儿是一些默认的 rss 模板,定制自己的模板时可以参照。

remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'acme_product_feed_rss2', 10, 1 );

function acme_product_feed_rss2( $for_comments ) {
    $rss_template = get_template_directory() . '/feeds/feed-acme_product-rss2.php';
//自定义模板的存放位置
    if( get_query_var( 'post_type' ) == 'acme_product' and file_exists( $rss_template ) )
//如果是 acme_product 类型的文章则使用自定义模板
        load_template( $rss_template );
    else
        do_feed_rss2( $for_comments ); // 否则使用默认模板
}

相关文章

  1. WordPress function bloginfo()
  2. wp_head() 函数优化
  3. Miniml – Free WordPress Theme
  4. Post Formats of WordPress
  5. wordpress分类列表函数:wp_list_categories 参数详解