I have page with page listings and this pages are parent pages and they have child pages, so this main page using my code is listing this child pages thumbnails. But the problem is that it is listing like this - Example : I have 3 ID-s 403,414,417. First it is listing all child pages thumbnais of 403,after 414,and at last 414. It means if I create page today with parent page 414, it will put this thumbnail after all 403 thumbnails when I need it to be the first in wrapper. So in one word I need to order this thumbnails by postdate "desc" but not separated by this ID blocks, I need it like one object ordering. I'll show code what I have maybe someone know the solution.
What I have
<div id="archive-thumbnails-listing" >
<?php $pages = array();
foreach (array(417, 403, 414) as $id) {
$pages = array_merge($pages, get_pages(array('child_of' => $id ,'sort_column' => 'post_date', 'sort_order' => 'desc' )));
} ?>
<?php foreach ($pages as $page): ?>
<div class="thumb12wrap">
<a href="<?php echo get_the_permalink($page->ID); ?>">
<?php echo get_the_post_thumbnail($page->ID, 'full'); ?></a>
<div class="thumbwrapper88">
<div class="shade23desc" ><a class="desc" href="<?php echo get_the_permalink($page->ID); ?>"><?php echo $page->post_title; ?></a></div>
<a class="descarea" href="<?php echo get_the_permalink($page->ID); ?>"></a>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
You have to write the code like below, after yesterday's chat i found the bug and solve it. So replace your code with below.
<?php
$pages = array();
foreach (array(403, 417, 414) as $id) {
$pages[] = get_pages(array('child_of' => $id ,'sort_column' => 'post_date', 'sort_order' => 'desc' ));
}
?>
<?php
if (count($pages)) {
for ($k = 0; $k < count($pages); $k++) {
foreach ($pages[$k] as $page):
?>
<div class="thumb12wrap">
<a href="<?php echo get_the_permalink($page->ID); ?>">
<?php echo get_the_post_thumbnail($page->ID, 'full'); ?></a>
<div class="thumbwrapper88">
<div class="shade23desc" ><a class="desc" href="<?php echo get_the_permalink($page->ID); ?>"><?php echo $page->post_title; ?></a></div>
<a class="descarea" href="<?php echo get_the_permalink($page->ID); ?>"></a>
</div>
</div>
<?php
endforeach;
}
}
?>
Hope this will work for you, Thanks!