2011-11-20 65 views

回答

0

基础上answer of Virgin,你基本上都首先要做的,就是让一个Feed templates,其位于/wp-includes/feed-myposttype.php 凡myposttype是你自定义文章类型名称

为了改变默认的RSS源,您将修改您所做的饲料myposttype.php模板,并重新定义了行动“do_feed_rss2”,就像这样:

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

function acme_product_feed_rss2($for_comments) { 
    $custom_type = 'myposttype'; //**your custom post type** 
    $rss_template = get_template_directory() . '/feeds/feed-myposttype.php'; 
    if(get_query_var('post_type') == $custom_type and file_exists($rss_template)) 
     load_template($rss_template); 
    else 
     do_feed_rss2($for_comments); // Call default function 
} 

另一种方法,是使用此逻辑评估Feed中的帖子是否为“特殊类别”的一部分,并启用仅针对该类别提及的下载功能。

0

您可以创建所谓的feed template,请参阅WordPress Codex部分,标题为“Customizing Feed Templates”,您将找到完整的说明。

+0

感谢您的回复。但我不明白如何实现它。 –