Closed

Modify wordpress get grandchildren

This project received 14 bids from talented freelancers with an average bid price of £27 GBP.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
£20 - £30 GBP
Total Bids
14
Project Description

Hi there,

I have the following script:

ID.'&sort_column=menu_order&child_of='.$posts[0]->ID);
if($child_pages) {
foreach($child_pages as $child_page) {
// loop stuff for child pages
echo '';
// get child pages of child page (grandchild pages)
$grandchild_pages = get_pages('sort_column=menu_order&child_of='.$child_page->ID);
if($grandchild_pages) {
foreach($grandchild_pages as $grandchild_page) {
// loop stuff for grandchild pages
if(has_post_thumbnail($grandchild_page->ID)) {
echo 'ID).'">'.get_the_post_thumbnail($grandchild_page->ID).'';
}

}
}
}
}
?>

This gets grandchild pages and orders them by menu order. However it orders them under parent like:

-Parent 1
-- 1
--2
--3
-Parent 2
-1
-2
-3

I need it not to split it up by parent so the order would be:
-1
-2
-3
-4
-5
-6

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online