WordPress.org

Ready to get started?Download WordPress

Forums

List a selected parents subpages with custom fields (2 posts)

  1. db1987
    Member
    Posted 4 years ago #

    I am using flutter, and I would like to list a selected parents child pages along with a custom field which I assigned to them using flutter.

    Please if anyone has any insight help me out. I can get the pages to list using:

    <?php
    $pageChildren = get_pages('sort_column=menu_order&hierarchical=0&child_of='. '134');
    if ( $pageChildren ) {
      foreach ( $pageChildren as $pageChild ) {
        echo '<li><a href="' . get_permalink($pageChild->ID) . '">'. $pageChild->post_title.'</a></li>';
          echo '<li>'.$key="toolname"; echo get_post_meta($post->ID, $key, true).'</li>';
        }
    }
    ?>

    Unfortunately the customfield "TOOLNAME" does not show my customfield.

    Thanks in advance

  2. MichaelH
    Member
    Posted 4 years ago #

    Should this:

    echo get_post_meta($post->ID, $key, true)

    be:

    echo get_post_meta($pageChild->ID, $key, true)

Topic Closed

This topic has been closed to new replies.

About this Topic