Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Pulling custom field data from child pages

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27527
    EamonnMac
    Member

    Hey guys,

    Wondering if this is possible, maybe ye can help me:

    I have a list at the bottom of each individual page listing all the other pages of that category (i.e. pages that have the same ‘parent’ page), for which I am using the following code. You can see a live example here: http://oldkitbag.com/cashelbay-wp/past-ponies/jjs-fiona/

    Code:
    post_parent)
    $children = wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&echo=0″);

    else

    $children = wp_list_pages(“title_li=&child_of=”.$post->ID.”&echo=0″);
    if ($children) { ?>

    • post_parent)) {
      $parentTitle = get_the_title($post->post_parent);?>
      See all Ponies listed under :

    It works no probs, it just looks crap. Now each of these child pages have custom fields, including thumbnails, and I’m wondering would it be possible to construct a list that not only coughs up the page titles but also the thumbnail custom field for each page as well. Any help would be greatly appreciated – even if it’s just to say its not possible! :D

    #69360
    Chris Coyier
    Keymaster

    You gotta run a loop if you want custom fields =)

    #70299
    EamonnMac
    Member

    I came accross the following at http://www.wprecipes.com/wordpress-how-to-get-custom-fields-outside-the-loop. Now, I think they are still running a loop per se – isn’t that what a wp_query is? But anyway, my point is this: could I use this code in some form to echo just the ‘thumbnail’ custom fields and the titles, both suitably permalinked, of all the pages of a given category, as in my original problem?

    Quote:
    To display a custom field value outside the loop, simply use the following code. Don’t forget to replace customField on line 4 by the name of the custom field you want to display.

    Code:
    post->ID;
    echo get_post_meta($postid, ‘customField’, true);
    ?>
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.