[wp-hackers] How to change the sorting order by of a custom post type's rss feed?

Christian Foster christian.foster at gmail.com
Mon Sep 27 17:41:23 UTC 2010


I'm not 100% sure but:

add_action( 'pre_get_posts', 'feed_filter' );
function feed_filter( $query )
{
if ( is_feed() ) {
  $query->set( 'meta_key', 'sdfsf' );
  $query->set( 'meta_value', 'sdfsf' );
  $query->set( 'orderby', 'meta_value');
  $query->set( 'order', 'DESC' );
}
}

might work?

On Mon, Sep 27, 2010 at 6:01 PM, Simon Blackbourn <piemanek at gmail.com> wrote:
>> I've been trying to setup a (rss) feed for my custom post type.
>> This works using the url parameter post_type.
>>
>> For example:
>> http://wordpress.com/feed/?post_type=my_custom_post_type
>>
>> However I would like to change the sorting of the custom posts based on a
>> meta key and value.
>>
>> I expected something like this:
>> http://wordpress.com/feed/?post_type=my_custom_post_type&order_by=meta_key
>>
>> Can somebody point me in the right direction on how to achieve this?
>>
>>
>
> i might be wrong, but wouldn't the sorting of posts in a feed be done by the
> user's feed reader, by looking at the date field in the xml? if so, you
> wouldn't have any control over it from within worpdress.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list