I’m working on a website where pages are listed out using get_pages in a gallery on the home page. Recently we added pages from a section section using two get_pages() calls and one array_merge() to get the array that would be used in the pages gallery list. Unfortunately, even though both arrays are set to sort by sort_column = post_date, one array is putting all of it’s entries above the other array even if the dates of those posts are further back than some of the posts in the other array. Is there a way to merge the arrays and sort them in a way that maintains an order based on the sort dates of both arrays?
You can see the code I’m using right now here:
$videoPages = get_pages("child_of=$videos&number=$pageCount&offset=$startCount&sort_column=post_date&sort_order=DESC&parent=$videos"); $projectPages = get_pages("child_of=$portfolio&number=$pageCount&offset=$startCount&sort_column=post_date&sort_order=DESC&parent=$portfolio"); $pages = array_merge( $videoPages, $projectPages );
A lot of the values in those arrays are set elsewhere.
You can see the page I’m working on here: http://www.anthembranding.com
Any help would be appreciated! Thanks.
- The topic ‘Order by post date with array_merge()?’ is closed to new replies.