WordPress.org

Ready to get started?Download WordPress

Forums

Query Child Pages of a Current Page and Loop Through Each Child Page (3 posts)

  1. davidzupec
    Member
    Posted 1 year ago #

    Hello all,

    For some reason this loop is generating the same custom field images on all my pages who are assigned this template. I believe my problem is I shouldn't assigned a post parent with an id of 55 because that page is correct but the rest are not. Not sure how to get this code correct. Please help, it would be very much appreciated : ) The following code is what I have on my page template:

    <?php query_posts("posts_per_page=-1&post_type=page&order=asc&post_parent=55"); if ( have_posts() ) while ( have_posts() ) : the_post(); ?>	
    
    <figure><a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, "detail_thumbnail", true); ?>" alt="" /></a></figure>	
    
    <?php endwhile; wp_reset_query(); ?>				
    
    </section>																				
    
    <?php endwhile; endif; ?>
  2. Rocco Tripaldi
    Member
    Posted 1 year ago #

    Try replacing:
    get_post_meta($post->ID

    with:
    get_post_meta(get_the_ID()

    can't guarantee that'll work, but worth a shot.

  3. davidzupec
    Member
    Posted 1 year ago #

    Hello, thanks for trying but no luck.

Topic Closed

This topic has been closed to new replies.

About this Topic