php - Reorder items in an RSS feed -


I have 2 websites, and I want to show some posts on another using RSS feed.

The problem is that, the default date appears according to the published date, where I have been ordered from the title. I am using Wordpress, which uses simple (which I believe Is that this very common?).

Is there a way to reorder these items before displaying these items? Thank you. to display RSS feed (set via CMS option) * $ num_posts = Number of posts to display from feeds (via CMS option) Set) * / $ Max_items = 0; If ($ feed! == ''): $ rss = fetch_feed ($ feed); If (! Is_wp_error ($ rss)): $ max_items = $ rss- & gt; Get_item_quantity ($ num_posts); $ Rss_items = $ rss- & gt; Get_items (0, $ max_items); end if; end if;

OK, so I have given an answer that seems to work. / P>

  need_once (ABSPATH. WPINC. '/class-feed.php'); Need_once (abp.pwnc. '/class-implepie.php'); Square SimplePie_Custom_Sort Expands Typewrite {/ ** * @ How to order the string wise feed * @access private * / var $ order_feed_by; / ** * Sort the item appearing in an RSS feed * / function sort_items ($ a, $ b) {/ ** Create the sort function name / $ sort_function = 'sort_items _'. $ This- & gt; Order_feed_by; / ** Check that the Sort function is present and call (Call 'Parent :: Sort_item' if not) * / if (method_exists ($ this, $ sort_function)): $ this- & gt; $ Sort_function ($ a, $ b); Other: parent :: sort_item ($ a, $ b); end if; } / ** * To sort posts in an RSS feed titled * Function * sort_items_title ($ a, $ b) {return $ b-> get_title () & lt; = $ A- & gt; Get_title (); }} Function fetch_feed_custom ($ url, $ order_by) {$ feed = new SimplePie_Custom_Sort (); $ Feed-> Order_feed_by = $ order_by; $ Feed- & gt; Set_feed_url ($ url); $ Feed- & gt; Set_cache_class ('WP_Feed_Cache'); $ Feed- & gt; Set_file_class ('WP_SimplePie_File'); $ Feed-> Set_mark_discovery (apply_filters ('wp_feed_cache_transient_lifetime', 43200, $ url)); Do_action_ref_array ('wp_feed_options', array (and $ feed, $ url)); $ Feed- & gt; Init (); $ Feed- & gt; Handle_content_type (); If ($ feed- & gt; error ()): return new WP_Error ('simplicity-error', $ feed-> error ()); end if; Return $ Feeds; }    

Comments