SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    querying child pages

    i have a parent PAGE and multiple sub-PAGES. I want to be able to pull the Title, Excerpt and a Custom field (vendor_img) from the sub-pages and have them appear in a list in the parent page.

    I tried using this code...
    Code:
    <div class="maincontent">
                   <?php the_ID(); ?>
                   <?php $parent = $post->ID; ?>
    <?php
    query_posts('post_type=page&post_parent='.$parent);
     while (have_posts()) : the_post();
    ?>
    
    <div class="imagelisting">
    <div class="Image">
        <?php $image = get_post_meta($post->ID, 'vendor_img', true); ?>
     </div>
      </div>
    <?php endwhile; ?>
    </div>
    but i receive an error message which you can see here on the parent page where i'm trying to get the child page info to appear in the list.

    should I be placing a parent PAGE category name or id somewhere in that code? is the problem something else?

    please advise. thanks in advance!

  2. #2
    SitePoint Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What have you done with that PHP code? Added it to your editor?

  3. #3
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, in the HTML editor for that page. i just realized i didn't have any plugin to run php in a page or post so I just installed an exec-php plugin: http://bluesome.net/post/2005/08/18/50/.

    now for some reason "250" appears on the screen.

    please advise. thanks!
    Last edited by jaymazz; Dec 23, 2011 at 15:14. Reason: just realized...


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •