2011-11-20 46 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

感謝您的回覆。但我不明白如何實現它。 –