Modify wordpress get grandchildren

  • Status Closed
  • 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

Get free quotes for a project like this
Skills Required

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