0

I am interested in showing content from my custom wordpress tables which includes various fields into wordpress Standard RSS Feed.

I have so far managed to display custom post type into standard feeds, however, this doesn't do my job as the content I want to display resides in a different custom tables. Content I will be pulling is about title, url, short_description, date etc

Code I have so far is:

add_filter('request', 'myfeed_request');

function myfeed_request($qv) {
    if (isset($qv['feed']))
        $qv['post_type'] = array('ipc_project_update');
    return $qv;
}

Above code pulls content for post type 'ipc_project_update', however, I want to change it so it pulls content from my custom tables. Any help please on how I can achieve this?

4

1 回答 1

0

好吧,我想我回答了我自己的问题。

我完成它的方式是按照以下工作流程使用:

  1. 为 rss 提要创建一个自定义模板文件,其中包含所有查询以提取所需的内容和 rss 代码。

  2. 然后在您的主题中处理以下代码functions.php

代码:

remove_all_actions( "do_feed_rss2" );

add_action( 'do_feed_rss2', 'ipc_project_feed_rss2', 10, 1 );

function ipc_project_feed_rss2( ) {
    if(file_exists(TEMPLATEPATH . '/ipc_rss_feed_template.php'))
        load_template( TEMPLATEPATH . '/ipc_rss_feed_template.php');
    else
        die("RSS Feed not found..");
}

上面的代码将覆盖您的标准提要,因此它将您的新自定义模板文件用于 RSS 提要

于 2013-06-06T13:43:57.813 回答