Viewing 1 replies (of 1 total)
  • Thread Starter caroline

    (@makeupedia)

    Found a solution here http://wordpress.stackexchange.com/questions/60292/wp-query-to-get-child-pages-of-current-page and did a minor tweak!

    This code below works just as I wanted!

    <?php
    
    $args = array(
        'post_type'      => 'produkt',
        'posts_per_page' => -1,
        'nopaging' => true,
        'post_parent'    => $post->ID,
        'order'          => 'ASC',
        'orderby'        => 'menu_order'
     );
    
    $parent = new WP_Query( $args );
    if ( $parent->have_posts() ) : ?>
        <?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
            <div id="parent-<?php the_ID(); ?>" class="parent-page">
    
               <h1><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( $_page->ID, 'thumbnail' ); ?></a></h1>
            </div>
        <?php endwhile; ?>
    <?php endif; wp_reset_query(); 
    
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Display child posts of parent (post relations)’ is closed to new replies.