[wp-hackers] Accessing custom post types and taxonomies across sites on a network

Mike Little wordpress at zed1.com
Tue Jan 25 23:41:39 UTC 2011


Looks like  my mail got truncated., ...

On 25 January 2011 23:40, Mike Little <wordpress at zed1.com> wrote:

> On 25 January 2011 23:09, Bill Dennen <dennen at gmail.com> wrote:
>
>> > Why not include the content from the faculty site as an RSS feed into
>> the
>> > department site. Do it using the built in WordPress RSS engine cache it
>> > (with a timeout) and render it appropriately,
>>
>> Thanks-
>>
>> I think RSS would work for generating simple lists of the profiles.
>> But, RSS does not include any custom fields. So, we would not be able
>> to pull over those custom fields with the default feeds.
>>
>> -Bill
>>
>
> There are two actions you should investigate: 'rss2_ns' and 'rss2_item'.
> The first gives you an opportunity to add some custom namespace extensions
> to the feed root tag. The second allows you to output any extra tags
> (prefixed with your custom namespace) before the closing item tag.
>
> If you are the only one consuming the extended feeds, you dont' really have
> to define a DTD for your extension.
>
>

add_action( 'rss2_ns', array( &$this, 'rss2_ns' ) );
add_action( 'rss2_item', array( &$this, 'rss2_item' ) );

function rss2_ns() {
 echo 'xmlns:faculty="http://your.domain.com/rss/2.0/faculty/"';
} // end rss2_ns

function rss2_item() {
  global $post;
  if ( 'faculty' === $post->post_type ) {
    $extra1 = get_post_meta( $post->ID, 'faculty_extra1', true );
    $extra2 = get_post_meta( $post->ID, 'faculty_extra2', true );
    echo '<faculty:extra1>' . $extra1 . '</faculty:extra1>';
    echo '<faculty:extra2>' . $extra2 . '</faculty:extra2>';
  }
} // end rss2_item








>   _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>


-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list