$rawpost ) $rawposts[$key]->post_content = null; // Loop through each post and sort it into a structured array foreach( $rawposts as $key => $post ) { $posts[ mysql2date( 'Y.m', $post->post_date ) ][] = $post; $rawposts[$key] = null; // Try and free up memory for users with lots of posts and poor server configs } $rawposts = null; // More memory cleanup // Store the results into the WordPress cache wp_cache_set( 'ar-posts', $posts ); return $posts; } // Generates the HTML output based on $atts array from the shortcode function aureola_arch_PostList() { global $wp_locale; // Get the big array of all posts $posts = aureola_arch_GetPosts(); // Sort the months based on $atts krsort( $posts ); // Sort the posts within each month based on $atts foreach( $posts as $key => $month ) { $sorter = array(); foreach ( $month as $post ) $sorter[] = $post->post_date_gmt; SORT_DESC; array_multisort( $sorter, $sortorder, $month ); $posts[$key] = $month; unset($month); } // Generate the HTML $html = '
'. "\n"; $html .= '' . __('Expand All', 'aureola') . "\n\n"; $html .= '\n
\n"; return $html; } // Returns the total number of posts function aureola_arch_PostCount() { $num_posts = wp_count_posts( 'post' ); return number_format_i18n( $num_posts->publish ); } // Deletes the cached filtered posts array for users using a persistent caching plugin function DeleteCache() { wp_cache_delete( 'ar-posts' ); } add_action( 'edit_post', 'DeleteCache' ); ?>