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


Page list that links to a media custom field

  • Hi, I need to get the sub page list of a main page (2 levels: main page -> first level -> second level). I would modify the html of this list to render a detail tag, so the first level (that don’t have the media custom field) open at the click and show the list of sub page that containing this media custom field. The custom field is a pdf.

    I have tryed a lot of solutions, but my low knowledge in development doesn’t allow me to obtain what I want.

  • A dev help me with the following code:

    $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 . ",";
       <?php wp_list_pages(array("child_of" => $ancestor_id, "include" => $incl, "link_before" => "", "title_li" => "", "sort_column" => "menu_order"));?>

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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.