- Add a Custom Post Type called
'feed'
- Add a Custom Taxonomy for ‘feed’ called
'feed_category'
- As you mentioned, use a Custom Post Type for your feed items, for example
'feed_item'
- When adding an
'feed_item'
, add post_meta which makes the link between'feed'
and'feed_item'
. For exampleupdate_post_meta( $item_id, 'feed', $feed_id );
Your loop can be used perfectly when using my suggested structure. At step 3 you query all posts with post meta 'feed_id' = $feed_id
.
Codex Links:
To get the feed items use the following code:
$category_id = 123;
$the_query = new WP_Query( array(
'post_type' => 'feed',
'feed_category' => $category_id
) );
$items = array();
while ( $the_query->have_posts() ) : $the_query->the_post();
$feed_items = get_posts( array(
'post_type' => 'feed_item',
'meta_key' => 'feed_id',
'meta_value' => $post->ID,
'numberposts' => -1
) );
$items = array_merge( $items, $feed_items );
endwhile;
wp_reset_postdata();
// now $items contains your feed items from the feeds in the feed_category with id 123