shopp_rss_item

filters the key/value pairs used to create xml feed markup for each item in the feed.

add_filter( 'shopp_rss_item', [callback] )

@param array $item the key/value pairs used to create xml feed markup for each item in the feed.
@param Product $Product the Product object being rendered in the feed

Description

filters the key/value pairs used to create xml feed markup for each item in the feed.

This filters is useful for adding or altering the values used for creating rss/xml feed markup. For instance, you can add Google Base specific elements to the markup of each item.

Example

// register filter callback
add_filter('shopp_rss_item', 'shopp_rss_item_fltr', 10, 2);

// create filter function
function shopp_rss_item_fltr( $item, $Product ) {
    // Shopp 1.2 usage
    // say you have registered a custom product taxonomy 'shopp_brand'
    $brands = wp_get_object_terms($Product->id, 'shopp_brand');

    // If this product has one or more shopp_brand term associated with it
    if ( is_array($brands) && ! empty($brands) ) {
        // Set Google Base g:brand from results
        $item['g:brand'] = $brands[0]->name;
    }
    return $item;
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar