Support

Account

Home Forums Front-end Issues Page list that links to a media custom field Reply To: Page list that links to a media custom field

  • A dev help me with the following code:

    <?php
    $ancestor_id=1843;//this code is wrong
    $descendants = get_pages(array('child_of' => $ancestor_id));
    $incl = "";
    
    foreach ($descendants as $page) {
       if (($page->post_parent == $ancestor_id) ||
           ($page->post_parent == $post->post_parent) ||
           ($page->post_parent == $post->ID))
       {
          $incl .= $page->ID . ",";
       }
    }?>
    
    <ul>
       <?php wp_list_pages(array("child_of" => $ancestor_id, "include" => $incl, "link_before" => "", "title_li" => "", "sort_column" => "menu_order"));?>
    </ul>

    But I think I no have the knowledge to custom it to my needs.